culinary.kemonine.info/themes/hugo-theme-techdoc/layouts/partials/meta/google-analytics-async.html

16 lines
506 B
HTML
Raw Normal View History

2022-12-03 15:27:03 +00:00
{{- if .Site.IsServer -}}
<!-- only production, not generate Google Analytics with Hugos built-in server -->
{{- else -}}
{{- with .Site.Params.google_analytics_id -}}
<!-- BEGIN: Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ . }}');
</script>
<!-- END: Google Analytics -->
{{- end -}}
{{- end -}}