1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-12-20 09:32:19 +01:00

Add google tag manager

This commit is contained in:
Simon Gemmell 2017-08-10 20:10:20 +10:00
parent dfb4e7fabd
commit ce91352dd5
2 changed files with 19 additions and 1 deletions

View File

@ -43,6 +43,9 @@ paginate = 5
# Format dates with Go's time formatting
date_format = "Mon Jan 02, 2006"
# Google Tag Manager id
# googleTagManager = "XXXZZZYYY"
# verification string for Google Webmaster Tools
#google_verify_meta = "BAi57DROASu4b2mkVNA_EyUsobfA7Mq8BmSg7Rn-Zp9"

View File

@ -2,6 +2,16 @@
<html lang="{{ .Lang }}">
<head>
{{ if .Site.Params.googleTagManager }}
<!-- 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','{{ .Site.Params.googleTagManager }}');</script>
<!-- End Google Tag Manager -->
{{ end }}
{{ partial "head-meta.html" . }}
{{ block "schema-dot-org" . }}
@ -30,7 +40,12 @@
</head>
<body>
{{ if .Site.Params.googleTagManager }}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ .Site.Params.googleTagManager }}"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
{{ end }}
<div class="blog-masthead">
<div class="container">
<nav class="nav blog-nav">