mirror of
https://github.com/imfing/hextra.git
synced 2025-10-13 20:31:52 -04:00
feat: support GoatCounter analytics (#814)
* feat: support GoatCounter analytics * docs: add docs for GoatCounter analytics refactor: move analytics documentation into its own section since there are now 4 supported analytics solutions * fix: addressing issues raised in PR * refactor: simplifying goat counter setting logic. refactor: simplify error handling with goat counter * fix: fixing goat counter erroring when a code is provided * fix: Applying suggested fixes * Update layouts/_partials/components/analytics/goat-counter.html --------- Co-authored-by: Xin <5097752+imfing@users.noreply.github.com>
This commit is contained in:
@@ -16,4 +16,9 @@
|
||||
{{ partial "components/analytics/matomo.html" . }}
|
||||
{{- end }}
|
||||
|
||||
<!-- GoatCounter -->
|
||||
{{- if .Site.Params.analytics.goatCounter -}}
|
||||
{{ partial "components/analytics/goat-counter.html" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- end }}
|
||||
|
17
layouts/_partials/components/analytics/goat-counter.html
Normal file
17
layouts/_partials/components/analytics/goat-counter.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{{- with .Site.Params.analytics.goatCounter -}}
|
||||
{{- if not .code -}}
|
||||
{{- errorf "Missing GoatCounter 'code' configuration. See https://imfing.github.io/hextra/versions/latest/docs/guide/configuration/#goatcounter-analytics" -}}
|
||||
{{- end -}}
|
||||
|
||||
<script
|
||||
data-goatcounter="https://{{ .code }}.goatcounter.com/count"
|
||||
data-goatcounter-settings='
|
||||
{
|
||||
"no_onload":{{ .noOnload | default false }},
|
||||
"no_events":{{ .noEvents | default false }},
|
||||
"allow_local":{{ .allowLocal | default false }},
|
||||
"allow_frame":{{ .allowFrame | default false }}
|
||||
}
|
||||
'
|
||||
async src="//gc.zgo.at/count.js"></script>
|
||||
{{- end -}}
|
Reference in New Issue
Block a user