Skip to content

Commit 14f665d

Browse files
committed
Update to Universal Google Analytics Script
Google is upgrading to their new "Universal Analytics." I'd recommend building that into this instead of the legacy ga.js script. https://developers.google.com/analytics/devguides/collection/analyticsjs/
1 parent 36b4c9b commit 14f665d

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

_includes/analytics.html

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
{% if site.google_analytics %}
22
<!-- Google Analytics -->
3-
<script type="text/javascript">
4-
5-
var _gaq = _gaq || [];
6-
_gaq.push(['_setAccount', '{{ site.google_analytics }}']);
7-
_gaq.push(['_trackPageview']);
8-
9-
(function() {
10-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
11-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
12-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
13-
})();
14-
3+
<script>
4+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
5+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
6+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
7+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
8+
9+
ga('create', '{{ site.google_analytics }}', 'auto');
10+
ga('send', 'pageview');
1511
</script>
16-
{% endif %}
12+
<!-- End Google Analytics -->
13+
{% endif %}

0 commit comments

Comments
 (0)