Skip to content

Instantly share code, notes, and snippets.

@maskingtape
Created March 25, 2013 10:20
Show Gist options
  • Save maskingtape/5236206 to your computer and use it in GitHub Desktop.
Save maskingtape/5236206 to your computer and use it in GitHub Desktop.
HTML5 boilerplate google analytics script loader generalised to include the font loader
var _gaq=[['_setAccount','UA-XXXXXXX-X'],['_trackPageview']],
WebFontConfig = { google: { families: [ 'Marvel::latin' ]}};
(function(d,t){
function addScript(p, url){
var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?p.s:p.n)+url;
s.parentNode.insertBefore(g,s);
}
addScript({ s: '//ssl', n: '//www'}, '.google-analytics.com/ga.js');
addScript({ s: 'https', n: 'http'}, '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js');
}(document,'script'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment