Track link clicks in Google Analytics
Using jquery, adding this little piece of code will enable you to track link clicks in Google Analytics with the href of the link as a reference:
$('a.ga-track').on('click', function() {
ga('send', 'event', 'page-links', 'clicked', $(this).attr('href'));
});
just add the desired class to every element you want to track.
Written by Raf Van Suetendael
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Jquery
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#