Skip to content

Commit 0a7250a

Browse files
DibranMuldertomap
authored andcommitted
Used Google's new Tag Manager code (hexojs#110)
1 parent 2e4a4c3 commit 0a7250a

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
<% if (theme.google_analytics){ %>
2-
<!-- Google Analytics -->
3-
<script type="text/javascript">
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', '<%= theme.google_analytics %>', 'auto');
10-
ga('send', 'pageview');
2+
<!-- Global site tag (gtag.js) - Google Analytics -->
3+
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= theme.google_analytics %>"></script>
4+
<script>
5+
window.dataLayer = window.dataLayer || [];
6+
function gtag(){dataLayer.push(arguments);}
7+
gtag('js', new Date());
118
9+
gtag('config', '<%= theme.google_analytics %>');
1210
</script>
1311
<!-- End Google Analytics -->
14-
<% } %>
12+
<% } %>

0 commit comments

Comments
 (0)