Skip to content

Instantly share code, notes, and snippets.

@GaryUnbounce
Created February 18, 2014 22:58
Show Gist options
  • Save GaryUnbounce/9082236 to your computer and use it in GitHub Desktop.
Save GaryUnbounce/9082236 to your computer and use it in GitHub Desktop.
Add KISSMetrics event tracking
<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