fmartingr
/
shelfzilla
Archived
1
0
Fork 0

Update google_analytics.html

Changed the code from synchronous to asynchronous in order to improve the load speed
This commit is contained in:
Calendal 2015-03-19 12:32:56 +01:00
parent 11b45966ae
commit 0353c5c8f6
1 changed files with 12 additions and 7 deletions

View File

@ -1,9 +1,14 @@
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ social_config.google_analytics }}']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();
ga('create', '{{ social_config.google_analytics }}', '{{ request.get_host }}');
ga('send', 'pageview');
</script>