Skip to content

Commit

Permalink
Add Google Tag Manager to the site (#4519)
Browse files Browse the repository at this point in the history
* Add Google Tag Manager to the site

Signed-off-by: Kenta Kozuka <[email protected]>

* Add breakline

Signed-off-by: Kenta Kozuka <[email protected]>

* Add breakline

Signed-off-by: Kenta Kozuka <[email protected]>

---------

Signed-off-by: Kenta Kozuka <[email protected]>
  • Loading branch information
kentakozuka authored Jul 21, 2023
1 parent 80d45ec commit 824f9c0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!doctype html>
<html lang="{{ .Site.Language.Lang }}" class="no-js">
<head>
{{ if eq (getenv "HUGO_ENV") "production" }}
{{ partial "gtm/head.html" . }}
{{ end }}
{{ partial "head.html" . }}
</head>
<body class="td-{{ .Kind }}">
{{ if eq (getenv "HUGO_ENV") "production" }}
{{ partial "gtm/body.html" . }}
{{ end }}
<header>
{{ partial "navbar.html" . }}
</header>
<div class="container-fluid td-default td-outer">
<main role="main" class="td-main">
{{ block "main" . }}{{ end }}
</main>
{{ partial "footer.html" . }}
</div>
{{ partialCached "scripts.html" . }}
</body>
</html>
4 changes: 4 additions & 0 deletions docs/layouts/partials/gtm/body.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KMRNSMX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
6 changes: 6 additions & 0 deletions docs/layouts/partials/gtm/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<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-KMRNSMX');</script>
<!-- End Google Tag Manager -->

0 comments on commit 824f9c0

Please sign in to comment.