Skip to content

Commit

Permalink
Change google analytics to gtags script
Browse files Browse the repository at this point in the history
  • Loading branch information
lubang committed Mar 10, 2018
1 parent fdeb102 commit 17c093e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 1 addition & 2 deletions 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>
11 changes: 11 additions & 0 deletions layouts/partials/header.html
Expand Up @@ -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">
Expand Down

0 comments on commit 17c093e

Please sign in to comment.