Created
February 18, 2014 22:58
-
-
Save GaryUnbounce/9082236 to your computer and use it in GitHub Desktop.
Add KISSMetrics event tracking
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
<script type="text/javascript"> | |
var getUrlParams = function () { | |
var params = {}, | |
hash; | |
var hashes = decodeURI(window.location.href).replace(/\+/g," ").slice(window.location.href.indexOf('?') + 1).split('&'); | |
for (var i = 0; i < hashes.length; i++) { | |
hash = hashes[i].split('='); | |
params[hash[0]] = unescape(hash[1]); | |
} | |
return params; | |
}; | |
var urlParam = getUrlParams(); | |
var identifier = urlParam['email']; | |
if (identifier != undefined) { | |
_kmq.push(['identify', unescape(identifier)]); | |
} | |
_kmq.push(['record', 'Unbounce Email Submit', urlParam]); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment