Add Google Analytics Partial
This commit is contained in:
parent
e6d2204df1
commit
1733418a49
@ -4,6 +4,7 @@
|
||||
|
||||
<head>
|
||||
{{ partial "head.html" . }}
|
||||
{{ partial "ga4.html" . }}
|
||||
</head>
|
||||
|
||||
{{ $theme := "auto"}}
|
||||
|
10
layouts/partials/ga4.html
Normal file
10
layouts/partials/ga4.html
Normal file
@ -0,0 +1,10 @@
|
||||
{{ if and (.Site.Params.googleAnalytics.enabled) (.Site.Params.googleAnalytics.ID) }}
|
||||
<!-- Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.Params.googleAnalytics.ID }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', '{{ .Site.Params.googleAnalytics.ID }}');
|
||||
</script>
|
||||
{{ end }}
|
Loading…
Reference in New Issue
Block a user