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 5b2748e commit 6609a69
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 @@ -65,14 +65,12 @@ <h1 class="title">{{ site.title | default: site.github.repository_name }}</h1>

{% 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 6609a69

Please sign in to comment.