Quellcode durchsuchen

Added Tag Manager

Yoginth vor 7 Jahren
Ursprung
Commit
5ff70e283f
3 geänderte Dateien mit 24 neuen und 9 gelöschten Zeilen
  1. 0 8
      templates/base/ga.tmpl
  2. 7 1
      templates/base/head.tmpl
  3. 17 0
      templates/base/verification.tmpl

+ 0 - 8
templates/base/ga.tmpl

@@ -1,8 +0,0 @@
-<script async src="https://www.googletagmanager.com/gtag/js?id=UA-107259345-2"></script>
-<script>
-  window.dataLayer = window.dataLayer || [];
-  function gtag(){dataLayer.push(arguments);}
-  gtag('js', new Date());
-
-  gtag('config', 'UA-107259345-2');
-</script>

+ 7 - 1
templates/base/head.tmpl

@@ -91,7 +91,7 @@
 	}
  	</script>
  	
- 	{{template "base/ga" .}}
+ 	{{template "base/verification" .}}
 
 	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
 	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.AreYouSure/1.9.0/jquery.are-you-sure.min.js"></script>
@@ -157,6 +157,12 @@
 
 </head>
 <body>
+	{{if .IsAdmin}}
+		<!-- Google Tag Manager (noscript) -->
+		<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KDDS3QW"
+		height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
+		<!-- End Google Tag Manager (noscript) -->
+	{{end}}
 	<div class="full height">
 		<noscript>This website works better with JavaScript</noscript>
 		{{if not .PageIsInstall}}

+ 17 - 0
templates/base/verification.tmpl

@@ -0,0 +1,17 @@
+<script async src="https://www.googletagmanager.com/gtag/js?id=UA-107259345-2"></script>
+<script>
+  window.dataLayer = window.dataLayer || [];
+  function gtag(){dataLayer.push(arguments);}
+  gtag('js', new Date());
+
+  gtag('config', 'UA-107259345-2');
+</script>
+
+<!-- Google Tag Manager -->
+<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
+new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
+j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
+'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
+})(window,document,'script','dataLayer','GTM-KDDS3QW');</script>
+<!-- End Google Tag Manager -->
+