Skip to content

Instantly share code, notes, and snippets.

@tpatch
Created January 20, 2016 19:16
Show Gist options
  • Save tpatch/ec9b0b5bc4bd71f1f3e9 to your computer and use it in GitHub Desktop.
Save tpatch/ec9b0b5bc4bd71f1f3e9 to your computer and use it in GitHub Desktop.
<amp-pixel src="https://ssl.google-analytics.com/collect?v=1&amp;tid=UA-XXXXXXXX-X&amp;t=pageview&amp;cid=$RANDOM&amp;dt=$TITLE&amp;dl=$CANONICAL_URL&amp;z=$RANDOM"></amp-pixel>
/*
* Required parameters:
* v = API version number (currently 1)
* tid = Google Analytics property identifier (UA-12345678-1)
* t = hit type
* cid = client id (you should implement this via cookie etc.)
* z = random string to bypass caching (amphtml generates this to $RANDOM variable)
*
* Some nice to have parameters:
* dt = document title ($TITLE)
* dl = document location ($CANONICAL_URL)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment