Skip to content

Commit

Permalink
Use async Google Analytics tracking code
Browse files Browse the repository at this point in the history
  • Loading branch information
benbalter committed Feb 17, 2017
1 parent 072d9d5 commit 24ea071
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ <h1 class="header">{{ site.title | default: site.github.repository_name }}</h1>
<!--[if !IE]><script>fixScale(document);</script><![endif]-->
{% if site.google_analytics %}
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("{{ site.google_analytics }}");
pageTracker._trackPageview();
} catch(err) {}
(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');
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
</body>
Expand Down

0 comments on commit 24ea071

Please sign in to comment.