From 3723e9b2b9baf9f700f5165ffd9a6ba25b25007a Mon Sep 17 00:00:00 2001 From: Ellison Date: Wed, 7 Oct 2020 11:53:36 -0300 Subject: [PATCH] Add goatcounter analytics support (#430) * adding goatcounter analytics support * Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 3 ++- exampleSite/config.toml | 6 +++++- layouts/_default/baseof.html | 3 +++ layouts/partials/analytics/goatcounter.html | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 layouts/partials/analytics/goatcounter.html diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 83a0617..43ed1c5 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -79,4 +79,5 @@ - [Dave Rolsky](https://github.com/autarch) - [Joseph Sanders](https://github.com/jls83) - [Rabin Adhikari](https://github.com/rabinadk1/) -- [Hussaini Zulkifli](https://github.com/hussaini/) \ No newline at end of file +- [Hussaini Zulkifli](https://github.com/hussaini/) +- [Ellison Leão](https://github.com/ellisonleao) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 0869cd6..8513aae 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -62,13 +62,17 @@ disqusShortname = "yourdiscussshortname" siteID = "ABCDE" # Default value is cdn.usefathom.com, overwrite this if you are self-hosting serverURL = "analytics.example.com" - + # If you want to use plausible(https://plausible.io) for analytics, add this section [params.plausibleAnalytics] domain = "example.com" # Default value is plausible.io, overwrite this if you are self-hosting or using a custom domain serverURL = "analytics.example.com" +# If you want to use goatcounter(https://goatcounter.com) for analytics, add this section +[params.goatCounter] + code = "code" + [taxonomies] category = "categories" series = "series" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 77c6cab..fd0618b 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -131,6 +131,9 @@ {{- partial "analytics/plausible" . -}} {{ end }} + {{ if and .Site.Params.goatCounter .Site.Params.goatCounter.code }} + {{- partial "analytics/goatcounter" . -}} + {{ end }} diff --git a/layouts/partials/analytics/goatcounter.html b/layouts/partials/analytics/goatcounter.html new file mode 100644 index 0000000..5ba3063 --- /dev/null +++ b/layouts/partials/analytics/goatcounter.html @@ -0,0 +1,2 @@ +