Skip to content

Instantly share code, notes, and snippets.

@codequistador
Created September 24, 2015 20:24
Show Gist options
  • Select an option

  • Save codequistador/81a61668625f873402be to your computer and use it in GitHub Desktop.

Select an option

Save codequistador/81a61668625f873402be to your computer and use it in GitHub Desktop.
Event Tracking JQuery
var event_tracking = [
//id, category, label
[ '#pnav ul li ul li a', 'nav', 'top nav' ],
[ '#pnav-reg', 'cta', 'top nav registration' ],
[ '#hero-reg', 'cta', 'hero registration' ],
[ '#early-reg', 'cta', 'early registration' ],
[ '#why-reg', 'cta', 'why registration' ],
[ '#fam-reg', 'cta', 'family discovery registration' ],
[ '#fourday-reg', 'cta', 'four day registration' ],
[ '#oneday-reg', 'cta', 'one day registration' ],
[ '#gs3-reg', 'cta', 'get started three day registration' ],
[ '#gs1-reg', 'cta', 'get started one day registration' ],
[ '#compare-reg', 'cta', 'comapre registrations' ],
[ '#pnav-reg', 'nav', 'footer nav' ],
];
$.each(event_tracking, function(k, v) {
$(v[0]).on('click', function() {
ga('send', 'event', v[1], 'click', v[2] );
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment