Skip to content

Commit cee8eed

Browse files
committed
Add google analytics.
1 parent 1ff7142 commit cee8eed

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

_layouts/default.html

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@
1010
<!--[if lt IE 9]>
1111
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
1212
<![endif]-->
13-
13+
<!-- Google tag (gtag.js) -->
14+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-TMTZVLLMBP"></script>
15+
<script>
16+
window.dataLayer = window.dataLayer || [];
17+
function gtag(){dataLayer.push(arguments);}
18+
gtag('js', new Date());
19+
gtag('config', 'G-TMTZVLLMBP');
20+
</script>
1421
{% seo %}
1522
</head>
1623

@@ -58,16 +65,5 @@
5865

5966
</div>
6067
</div>
61-
62-
{% if site.google_analytics %}
63-
<script>
64-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
65-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
66-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
67-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
68-
ga('create', '{{ site.google_analytics }}', 'auto');
69-
ga('send', 'pageview');
70-
</script>
71-
{% endif %}
7268
</body>
7369
</html>

_layouts/documentation.html

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
<meta http-equiv="X-UA-Compatible" content="IE=edge">
77
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
88
<link rel="stylesheet" type="text/css" href="{{ '/assets/css/print.css' | relative_url }}" media="print">
9+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-TMTZVLLMBP"></script>
10+
<script>
11+
window.dataLayer = window.dataLayer || [];
12+
function gtag(){dataLayer.push(arguments);}
13+
gtag('js', new Date());
14+
gtag('config', 'G-TMTZVLLMBP');
15+
</script>
916
<!--[if lt IE 9]>
1017
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
1118
<![endif]-->
@@ -76,16 +83,5 @@ <h1>User Guide to Slang</h1>
7683

7784
</div>
7885
</div>
79-
80-
{% if site.google_analytics %}
81-
<script>
82-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
83-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
84-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
85-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
86-
ga('create', '{{ site.google_analytics }}', 'auto');
87-
ga('send', 'pageview');
88-
</script>
89-
{% endif %}
9086
</body>
9187
</html>

0 commit comments

Comments
 (0)