about icon indicating copy to clipboard operation
about copied to clipboard

Efficiently track every CTA/link in GA

Open bretthayes opened this issue 3 years ago • 0 comments

What: Instead of adding data attributes to every link/CTA, create a hook with an event listener and some conditions to track every link/CTA click event in GA.

Why:

  • To reduce the amount of markup
  • To reduce the amount of manual labour
  • To track literally every link element/CTA by categorizing events under specific conditions:
    • Add data-category on parent elements for location categories
    • Check children element types and class names for button styles
  • To be more efficient and accurate with CTA tracking

CTA Tracking doc

bretthayes avatar Jul 20 '22 20:07 bretthayes