Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lubang/hugo-hello-programmer-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlubang <lubang@lulab.net>2018-03-10 08:29:59 +0300
committerlubang <lubang@lulab.net>2018-03-10 08:29:59 +0300
commit17c093e0467ad78f2f93d0cfd7c84cb5d0df60fa (patch)
tree974086a87fcfebc9c46e529d638db574b17ad1d0
parentfdeb10293466fae043244d6bb1c0d77676eac196 (diff)
Change google analytics to gtags script
-rw-r--r--layouts/partials/footer.html3
-rwxr-xr-xlayouts/partials/header.html11
2 files changed, 12 insertions, 2 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 14cfa55..b8371db 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,7 +1,6 @@
<footer class="footer">
COPYRIGHT (C) <a href="https://blog.lulab.net">DONGGEUN,BANG</a>. ALL RIGHTS RESERVED.
</footer>
-{{ template "_internal/google_analytics_async.html" . }}
-</body>
+</body>
</html>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 3592e83..373997e 100755
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -2,6 +2,17 @@
<html>
<head>
+ {{ if .Site.GoogleAnalytics }}
+ <script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.GoogleAnalytics }}"></script>
+ <script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', '{{ .Site.GoogleAnalytics }}');
+ </script>
+ {{ end }}
+
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>{{ .Title }} {{ if ne .Title .Site.Title }} &middot; {{ .Site.Title }}{{ end }}</title>
<link rel="icon" href="{{ "/favicon.ico" | relURL }}" type="image/x-icon">