mirror of
https://github.com/imfing/hextra.git
synced 2025-08-26 00:36:44 -04:00
58 lines
1.9 KiB
HTML
58 lines
1.9 KiB
HTML
![]() |
{{- /*
|
||
|
Umami Analytics
|
||
|
https://umami.is/docs/tracker-configuration
|
||
|
*/ -}}
|
||
|
|
||
|
{{- with .Site.Params.analytics.umami -}}
|
||
|
|
||
|
{{- if not .serverURL }}
|
||
|
{{- errorf "Missing Umami 'serverURL' configuration. See TODO" -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- if not .websiteID }}
|
||
|
{{- errorf "Missing Umami 'websiteID' configuration. See TODO" -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- $attributes := newScratch -}}
|
||
|
|
||
|
{{- $attributes.SetInMap "umami" "src" (printf "%s/%s" .serverURL (.scriptName | default "umami.js")) -}}
|
||
|
{{- $attributes.SetInMap "umami" "data-website-id" .websiteID -}}
|
||
|
|
||
|
{{- if .hostURL -}}
|
||
|
{{- /* https://umami.is/docs/tracker-configuration#data-host-url */ -}}
|
||
|
{{- $attributes.SetInMap "umami" "data-host-url" .hostURL -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- if .autoTrack -}}
|
||
|
{{- /* https://umami.is/docs/tracker-configuration#data-auto-track */ -}}
|
||
|
{{- $attributes.SetInMap "umami" "data-auto-track" .autoTrack -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- if .tag -}}
|
||
|
{{- /* https://umami.is/docs/tracker-configuration#data-tag */ -}}
|
||
|
{{- $attributes.SetInMap "umami" "data-tag" .tag -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- if .excludeSearch -}}
|
||
|
{{- /* https://umami.is/docs/tracker-configuration#data-exclude-search */ -}}
|
||
|
{{- $attributes.SetInMap "umami" "data-exclude-search" .excludeSearch -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- if .excludeHash -}}
|
||
|
{{- /* https://umami.is/docs/tracker-configuration#data-exclude-hash */ -}}
|
||
|
{{- $attributes.SetInMap "umami" "data-exclude-hash" .excludeHash -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- if .doNotTrack -}}
|
||
|
{{- /* https://umami.is/docs/tracker-configuration#data-do-not-track */ -}}
|
||
|
{{- $attributes.SetInMap "umami" "data-do-not-track" .doNotTrack -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- if .domains -}}
|
||
|
{{- /* https://umami.is/docs/tracker-configuration#data-domains */ -}}
|
||
|
{{- $attributes.SetInMap "umami" "data-domains" .domains -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
<script async defer {{ range $k, $v := ($attributes.Get "umami" ) }} {{ (printf `%s=%q` $k $v) | safeHTMLAttr }}{{- end -}}></script>
|
||
|
{{- end -}}
|