Created
September 24, 2015 20:24
-
-
Save codequistador/81a61668625f873402be to your computer and use it in GitHub Desktop.
Event Tracking JQuery
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
| 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