Skip to content

Commit

Permalink
Upgrade Google Analytics, thanks to @laoyang945
Browse files Browse the repository at this point in the history
Upgrade Google Analytics from ga.js to analytics.js
  • Loading branch information
xiangming committed Aug 26, 2014
1 parent 530928f commit 5f0615d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions layout/_partial/google-analytics.ejs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<% if (theme.google_analytics){ %>
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<%= theme.google_analytics %>']);
_gaq.push(['_trackPageview']);
(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', '<%= theme.google_analytics %>', 'auto');
ga('send', 'pageview');
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- End Google Analytics -->
<% } %>

0 comments on commit 5f0615d

Please sign in to comment.