Skip to content

Instantly share code, notes, and snippets.

@phiggins42
Created April 14, 2010 15:40
Show Gist options
  • Save phiggins42/365973 to your computer and use it in GitHub Desktop.
Save phiggins42/365973 to your computer and use it in GitHub Desktop.
(function(d){
// change to fit needs:
var acct = "UA-843203-1", page = "someIdentifier", delay = 300;
// won't need to change much (if any) below here:
var h = d.getElementsByTagName("head")[0], s = d.createElement("script");
s.src = ("https:" == d.location.protocol ? "https://ssl." : "http://www.")
+ "google-analytics.com/ga.js";
s.onload = s.onreadystatechange = function(e){
if(e && e.type == "load" || /loaded|complete/.test(s.readyState)){
s.onload = s.onreadystatechange = null;
_gat._getTracker(acct)._trackPageview(page);
h.removeChild(s);
}
}
setTimeout(function(){ h.appendChild(s); }, delay);
})(document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment