aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/_includes/common
diff options
context:
space:
mode:
Diffstat (limited to '_includes/common')
-rw-r--r--_includes/common/ga.html9
-rw-r--r--_includes/common/header.html4
2 files changed, 13 insertions, 0 deletions
diff --git a/_includes/common/ga.html b/_includes/common/ga.html
new file mode 100644
index 0000000..56eaca7
--- /dev/null
+++ b/_includes/common/ga.html
@@ -0,0 +1,9 @@
+<!-- Global site tag (gtag.js) - Google Analytics -->
+<script async src="https://www.googletagmanager.com/gtag/js?id={{ include.ga_tag }}"></script>
+<script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', '{{ include.ga_tag }}');
+</script>
diff --git a/_includes/common/header.html b/_includes/common/header.html
index a41b26e..8546fb5 100644
--- a/_includes/common/header.html
+++ b/_includes/common/header.html
@@ -58,6 +58,10 @@
<link rel="stylesheet" href="{{ url }}">
{% endfor %}
{% endif %}
+
+ {% if site.settings.ga_tag %}
+ {% include common/ga.html ga_tag=site.settings.ga_tag %}
+ {% endif %}
</head>
<body>
<div class="top-level-footer-wrapper">