Best Method for Link Tracking | Community
Skip to main content
courtneya707225
April 16, 2020
Solved

Best Method for Link Tracking

  • April 16, 2020
  • 2 replies
  • 4808 views

I am currently rebuilding a site's analytics code from scratch and for link tracking, the current implementation relies on CSS selectors with data- attributes. I've used this method in the past, but this makes me reliant on front-end changes, and could be liable to break during any new release. In the past, I've also used custom events passed to me through the front-end, but then that also makes the Launch implementation even more reliant on front-end releases (but less likely to break), thereby circumventing the whole notion of a tag manager.

 

Thoughts?

 

Thank you in advance

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Andrey_Osadchuk

From my point of view, your current approach is the best practice. The only addition I would advise to consider is when the link tracking is associated with single page applications (SPA). For SPA custom events or event based data layer may work better, primarily for the links that are triggering app state changes.

2 replies

Andrey_Osadchuk
Andrey_OsadchukAccepted solution
Level 10
April 16, 2020

From my point of view, your current approach is the best practice. The only addition I would advise to consider is when the link tracking is associated with single page applications (SPA). For SPA custom events or event based data layer may work better, primarily for the links that are triggering app state changes.

courtneya707225
April 24, 2020
thanks!
pradeep_07
Level 4
March 12, 2021
Its better to have LinkClick Data layer for every anchor tag you wanted to track. By doing this, you will not have any dependency with front end.