Skip to content

Instantly share code, notes, and snippets.

@mathiasbynens
Forked from 140bytes/LICENSE.txt
Created May 23, 2011 07:47
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathiasbynens/986371 to your computer and use it in GitHub Desktop.
Save mathiasbynens/986371 to your computer and use it in GitHub Desktop.
Google Analytics snippet in 140 bytes
function(){with(document)body.appendChild(createElement('script')).src='//mths.be/g',_gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']]}
Author: Mathias Bynens <http://mathiasbynens.be/>
This code is licensed under the WTFPL. Feel free to relicense as needed.
{
"name": "googleAnalytics",
"keywords": [
"google",
"analytics",
"google analytics",
"tracking"
]
}
@jed
Copy link

jed commented May 23, 2011

i also think you could save bytes and make this more useful by passing the UA-XXXXX-X id as a parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment