Created
January 8, 2018 17:41
-
-
Save Garconis/625eb196cbee4607fe61bf05eba765db to your computer and use it in GitHub Desktop.
Add Google Analytics Events via jQuery
This file contains 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
// Category > Action > Label | |
jQuery(document).ready(function() { | |
//Log GA Event for Sidebar MailChimp form submit click | |
jQuery('#mk-sidebar #mc-embedded-subscribe').click(function() { | |
ga('send', 'event', 'Subscribe', 'Click', 'Sidebar'); | |
}); | |
//Log GA Event for Top Bar MailChimp form submit click | |
jQuery('#mailchimp-top-bar .mctb-button').click(function() { | |
ga('send', 'event', 'Subscribe', 'Click', 'Header'); | |
}); | |
//Log GA Event for Bloom Popup MailChimp form submit click | |
jQuery('.et_bloom_popup .et_bloom_submit_subscription').click(function() { | |
ga('send', 'event', 'Subscribe', 'Click', 'Popup'); | |
}); | |
//Log GA Event for Bloom Posts Bottom MailChimp form submit click | |
jQuery('.et_bloom_below_post .et_bloom_submit_subscription').click(function() { | |
ga('send', 'event', 'Subscribe', 'Click', 'Posts Bottom'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment