-
-
Save kjy112/808324fded06824b45193e1be0f19241 to your computer and use it in GitHub Desktop.
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
/* Using JQuery. In MailChimp case, since they assigned jQuery to $mcj | |
* var $mcj = jQuery.noConflict(true); | |
* replace jQuery with $mcj for best practice | |
*/ | |
jQuery('#mce-success-response').bind("DOMSubtreeModified", function() { | |
/* Do whatever you wish upon successful email submission */ | |
/* Setup Google Analytics Conversion Tracking */ | |
ga('send', { | |
hitType: 'event', | |
eventCategory: 'MailChimp', | |
eventAction: 'Email Submit', | |
eventLabel: 'Fall Campaign' | |
}); | |
/* Redirect to a link of your choice with setTimeout */ | |
setTimeout(function() { | |
window.open('http://google.com', '_blank'); | |
}, 3000); | |
}); | |
/* Pure JavaScript version */ | |
document.getElementById('mce-success-response').addEventListener("DOMSubtreeModified", function() { | |
/* Do whatever you wish upon successful email submission */ | |
/* Setup Google Analytics Conversion Tracking */ | |
ga('send', { | |
hitType: 'event', | |
eventCategory: 'MailChimp', | |
eventAction: 'Email Submit', | |
eventLabel: 'Fall Campaign' | |
}); | |
/* Redirect to a link of your choice with setTimeout */ | |
setTimeout(function() { | |
window.open('http://google.com', '_blank'); | |
}, 3000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment