Bläddra i källkod

Try adding Analytics

Håvard O. Nordstrand 5 år sedan
förälder
incheckning
2121f05c41
3 ändrade filer med 4 tillägg och 3 borttagningar
  1. 2 0
      _includes/google_analytics.html
  2. 2 0
      _includes/header.md
  3. 0 3
      _layouts/head.html

+ 2 - 0
_includes/google_analytics.html

@@ -1,4 +1,5 @@
 <!-- Global site tag (gtag.js) - Google Analytics -->
+{% if site.google_analytics and jekyll.environment == 'production' %}
 <script async src="https://www.googletagmanager.com/gtag/js?id={{ google_analytics }}"></script>
 <script>
   window.dataLayer = window.dataLayer || [];
@@ -7,3 +8,4 @@
 
   gtag('config', '{{ google_analytics }}');
 </script>
+{% endif %}

+ 2 - 0
_includes/header.md

@@ -1,3 +1,5 @@
+{% include analytics.html %}
+
 # {{ site.name }} / {{ page.title }}
 {:.no_toc}
 

+ 0 - 3
_layouts/head.html

@@ -1,3 +0,0 @@
-{% if site.google_analytics and jekyll.environment == 'production' %}
-{% include analytics.html %}
-{% endif %}