Skip to content

Commit f77bc07

Browse files
MattRowe18bernatx
authored andcommitted
added google analytics
1 parent 4a1f222 commit f77bc07

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ plugins:
5454
- jekyll-mentions
5555
- jekyll-paginate
5656
- jekyll-seo-tag
57+
58+
# Google Analytics
59+
google_analytics: G-VS72TKL88S

_includes/analytics.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- Google tag (gtag.js) -->
2+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
3+
<script>
4+
window.dataLayer = window.dataLayer || [];
5+
function gtag(){dataLayer.push(arguments);}
6+
gtag('js', new Date());
7+
8+
gtag('config', '{{ site.google_analytics }}');
9+
</script>

_includes/head.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
{% if site.google_analytics and jekyll.environment == 'production' %}
2+
{% include analytics.html %}
3+
{% endif %}
14
<head>
25
<meta charset="utf-8">
36
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

0 commit comments

Comments
 (0)