mirror of
https://github.com/LukasJoswiak/etch.git
synced 2024-05-16 21:28:31 -04:00
implement google analytics tag conditional on param
This commit is contained in:
parent
304717159c
commit
ed2aac50d5
9
layouts/partials/analytics.html
Normal file
9
layouts/partials/analytics.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.Params.google_analytics }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ .Site.Params.google_analytics }}');
|
||||
</script>
|
|
@ -1,4 +1,7 @@
|
|||
<head>
|
||||
{{ if $googleAnalytics := .Site.Params.google_analytics }}
|
||||
{{ partial "analytics.html" . }}
|
||||
{{ end }}
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
{{ with .Site.Params.description -}}
|
||||
|
|
Loading…
Reference in a new issue