Skip to content

Instantly share code, notes, and snippets.

@r-isayev-parc
Forked from meritt/social.js
Created November 30, 2011 11:32
Show Gist options
  • Save r-isayev-parc/1408765 to your computer and use it in GitHub Desktop.
Save r-isayev-parc/1408765 to your computer and use it in GitHub Desktop.
Асинхронное подключение Google Analytics, Google +1, Facebook SDK, Twitter Widgets и Вконтакте API
(function(window, document) {
window.___gcfg = { // Настройки языка для Google +1 Button
lang: 'ru'
};
window._gaq = [ // Настройки Google Analytics
['_setAccount', 'UA-XXXXXX-1'],
['_trackPageview'],
['_trackPageLoadTime']
];
var apis = [
'https://apis.google.com/js/plusone.js', // Google +1 Button
'//userapi.com/js/api/openapi.js?34', // Vkontakte API
'//platform.twitter.com/widgets.js', // Twitter Widgets
'//connect.facebook.net/ru_RU/all.js#xfbml=1', // Facebook SDK
('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js' // Google Analytics
],
iterator = apis.length,
script = 'script',
fragment = document.createDocumentFragment(),
element = document.createElement(script),
clone;
while (iterator--) {
clone = element.cloneNode(false);
clone.async = clone.src = apis[iterator];
fragment.appendChild(clone);
}
clone = document.getElementsByTagName(script)[0];
clone.parentNode.insertBefore(fragment, clone);
})(this, document);
(function(c,b){c.___gcfg={lang:"ru"};c._gaq=[["_setAccount","UA-XXXXXX-1"],["_trackPageview"],["_trackPageLoadTime"]];for(var d=["https://apis.google.com/js/plusone.js","//userapi.com/js/api/openapi.js?34","//platform.twitter.com/widgets.js","//connect.facebook.net/ru_RU/all.js#xfbml=1",("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js"],e=d.length,f=b.createDocumentFragment(),g=b.createElement("script"),a;e--;)a=g.cloneNode(false),a.async=a.src=d[e],f.appendChild(a);a=b.getElementsByTagName("script")[0];
a.parentNode.insertBefore(f,a)})(this,document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment