Created
September 24, 2012 16:54
-
-
Save tommymarshall/3776989 to your computer and use it in GitHub Desktop.
GA Print 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
trackPrint: function() { | |
var timestamp = new Date().getTime(); | |
var img = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/__utm.gif?'; | |
img += 'utmac=UA-6451336-1&'; | |
img += 'utmp=' + window.location.origin + '/print' + window.location.pathname + '&'; | |
img += 'utmcc=__utma%3D[INSERT UTMA VALUE].' + timestamp + '.1%3B%2B__utmz%3D[INSERT UTMZ VALUE]%3B'; | |
console.log(img) | |
$('<style media="print">body:after { content:url("' + img + '"); }</style>').appendTo('head'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment