-
-
Save antz29/3691235 to your computer and use it in GitHub Desktop.
A minimalist way of including social JavaScript SDKs into a page. Includes Google Analytics, Twitter widgets, Facebook, and Google +1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.___gcfg={lang:'en-GB'};var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-123456-9']);_gaq.push(['_trackPageview']);!function(d,s){var st=d.getElementsByTagName(s)[0],j=function(i,u){d.getElementById(i)&&return;var js=d.createElement(s);js.id=i;js.async=true;js.src=u;st.parentNode.insertBefore(js,st)};setTimeout(function(){j("twitter-wjs","//platform.twitter.com/widgets.js");j("facebook-jssdk","//connect.facebook.net/en_GB/all.js#xfbml=1");j("gplusone-sdk","https://apis.google.com/js/plusone.js")}, 0);j("ga-sdk",('https:'==d.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js')}(document,'script'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.___gcfg = {lang: 'en-GB'}; | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-123456-9']); | |
_gaq.push(['_trackPageview']); | |
!function(d,s){ | |
var st = d.getElementsByTagName(s)[0], | |
j = function(id, url){ | |
d.getElementById(id) && return; | |
var js=d.createElement(s); | |
js.id=id; js.async=true; js.src=url; | |
st.parentNode.insertBefore(js,st); | |
}; | |
setTimeout(function(){ | |
j("twitter-wjs", "//platform.twitter.com/widgets.js"); | |
j("facebook-jssdk", "//connect.facebook.net/en_GB/all.js#xfbml=1"); | |
j("gplusone-sdk", "https://apis.google.com/js/plusone.js"); | |
}, 0); | |
j("ga-sdk", ('https:'==d.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js'); | |
}(document,'script'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just a hint: this needs updating, because
blah&&return
isn't valid JS... it needs to beif(blah)return