Created
October 2, 2012 18:35
-
-
Save eduardocereto/3822158 to your computer and use it in GitHub Desktop.
GAS firing MaxScroll with sampling
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
var _gas = _gas || []; | |
_gas.push(['_setAccount', 'UA-YYYYYY-Y']); // REPLACE WITH YOUR GA NUMBER | |
_gas.push(['_setDomainName', '.mydomain.com']); // REPLACE WITH YOUR DOMAIN | |
_gas.push(['_trackPageview']); | |
_gas.push(['_gasTrackForms']); | |
_gas.push(['_gasTrackOutboundLinks']); | |
// Max Scroll on 20% of the pages | |
if(Math.random() * 100 < 20) { | |
_gas.push(['_gasTrackMaxScroll']); | |
} | |
_gas.push(['_gasTrackDownloads']); | |
_gas.push(['_gasTrackYoutube', {force: true}]); | |
_gas.push(['_gasTrackVimeo', {force: true}]); | |
_gas.push(['_gasTrackMailto']); | |
(function() { | |
var ga = document.createElement('script'); | |
ga.type = 'text/javascript'; | |
ga.async = true; | |
ga.src = '/gas.js'; | |
var s = document.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(ga, s); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment