add data attribute to title url
refactor and fix click counting code