Last active
February 27, 2019 19:40
-
-
Save terryupton/96de5a42dff14010328f to your computer and use it in GitHub Desktop.
Event Tracking Google Analytics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ga('send','event','CTA','Get A Quote Button','On Page Location?') | |
// /* ========================================================================== | |
// //GOOGLE ANALYTICS TRACKING EVENTS | |
// | |
// ========================================================================== */ | |
if(typeof (ga) !== "undefined") { | |
$('.track-cta').on('click', function() { | |
ga('send', 'event', 'Call to Action', $(this).data('title'), $(this).data('placement')); | |
}); | |
$('.track-social').on('click', function() { | |
ga('send', 'event', 'Social', 'Visit', $(this).attr('title')); | |
}); | |
$('.track-form').on('click', function() { | |
ga('send', 'event', 'Form', 'Submitted', window.location.href); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment