Skip to content

Instantly share code, notes, and snippets.

@digdeep
Last active August 29, 2015 14:13
Show Gist options
  • Save digdeep/5effd8ccad780161d40d to your computer and use it in GitHub Desktop.
Save digdeep/5effd8ccad780161d40d to your computer and use it in GitHub Desktop.
maichimp javascript get user id
<script type="text/javascript">
if(window.location.href.indexOf("&mc_cid")) {
var a_mc_cid = location.search.split('&')[7];
var b_mc_cid = a_mc_cid.split('=')[1];
var a_mc_eid = location.search.split('&')[8];
var b_mc_eid = a_mc_eid.split('=')[1];
dataLayer.push ({ 'event': 'mailchimp', 'eventCategory': b_mc_cid, 'eventAction': b_mc_eid, 'eventLabel': '{{WPeventId}}', 'nonInteraction': 1 });
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment