Skip to content

Instantly share code, notes, and snippets.

@antlis
Last active August 21, 2019 03:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antlis/af490c77864dfca8ad6e602abb107df1 to your computer and use it in GitHub Desktop.
Save antlis/af490c77864dfca8ad6e602abb107df1 to your computer and use it in GitHub Desktop.
Google analytics pug mixin, HTML5 boilerplate like
mixin ga(id)
//- Pass your ga id, as attribute, eg. +ga('yourid12345')
script.
window.ga = function () { ga.q.push(arguments) }; ga.q = []; ga.l = +new Date;
ga('create', '!{id}', 'auto'); ga('set','transport','beacon'); ga('send', 'pageview')
script(src='https://www.google-analytics.com/analytics.js')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment