Utility Class of tracking <a></a>
tag click events by using Google Analyitcs
Utility Class of tracking <a></a>
tag click events by using Google Analyitcs
bower install GaTrackingAtagEvent --save
load this scripts
<!-- load this script -->
<script src="bower_components/GaTrackingAtagEvent/dist/GaTrackingAtagEvent.min.js"></script>
add attribute (data-ga-label) in <a></a>
tag which you want to tracking click event by google analytics.
<!-- call ga('send', 'event', 'link', 'click', ${location.pathname}__toppage); -->
<a href="/" data-ga-label="toppage">
<!-- call ga('send', 'event', 'link', 'click', ${location.pathname}__itempage); -->
<a href="/item" data-ga-label="itempage">
<!-- do not tracking click event of this a tag -->
<a href="/page3">
If you want to check the value which you send to google analyitcs you have to install google analytics debugger in chrome
- This script support Universal Analytics (analytics.js)