Created
July 21, 2009 19:32
-
-
Save mig/151538 to your computer and use it in GitHub Desktop.
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
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