Refactoring click tracking