Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
document.cookie.split(';').each(function(cookie) {
if(cookie.indexOf('__utmz') != '-1') utmz = cookie;
});
var cpc_regex = new RegExp(".*?utmcmd=([a-z]+)\|");
medium = utmz.match(cpc_regex)[1];
var gclid_regex = new RegExp(".*?utmgclid=([\_0-9A-Za-z]+)\|");
adwords = utmz.match(gclid_regex)[1];
if(medium == 'cpc' || adwords) firstTracker._setVar('CPC');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.