From c8e6aa6d91529258c22a388724c4db366b979282 Mon Sep 17 00:00:00 2001 From: Easton Man Date: Sun, 19 Mar 2023 22:27:53 +0800 Subject: [PATCH] feat(analytics): Add umami analytics (#787) ### Prerequisites - [ ] This pull request fixes a bug. - [x] This pull request adds a feature. - [ ] This pull request introduces breaking change. ### Description Add [Umami](https://umami.is) analytic. I use umami myself, and I added umami if anyone would like an easy way to integrate with umami. ### Issues Resolved N/A ### Checklist #### General - [x] Describe what changes are being made - [x] Explain why and how the changes were necessary and implemented respectively - [x] Reference issue with `#` if applicable #### Resources - [x] If you have changed any SCSS code, run `make release` to regenerate all CSS files #### Contributors - [x] Add yourself to `CONTRIBUTORS.md` if you aren't on it already --- CONTRIBUTORS.md | 1 + docs/analytics.md | 1 + docs/analytics/umami.md | 7 +++++++ layouts/_default/baseof.html | 18 ++++++++++++------ layouts/partials/analytics/umami.html | 4 ++++ 5 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 docs/analytics/umami.md create mode 100644 layouts/partials/analytics/umami.html diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9a797546d..a631bcb35 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -127,3 +127,4 @@ - [MichaƂ Pawlik](https://michalp.net) - [Kilian Kluge](https://github.com/ionicsolutions) - [Jaroslaw Rozanski](https://jarekrozanski.eu) +- [Easton Man](https://github.com/eastonman) diff --git a/docs/analytics.md b/docs/analytics.md index a9514029a..3b3e5f969 100644 --- a/docs/analytics.md +++ b/docs/analytics.md @@ -13,4 +13,5 @@ * [Matomo](https://matomo.org/) - [documentation](/docs/analytics/matomo.md) * [Micro Analytics](https://microanalytics.io/) - [documentation](/docs/analytics/microanalytics.md) * [Plausible Analytics](https://plausible.io/) - [documentation](/docs/analytics/plausible.md) +* [Umami](https://umami.is/) - [documentation](/docs/analytics/umami.md) * [Wide Angle Analytics](https://wideangle.co/) - [documentation](/docs/analytics/wideangle.md) \ No newline at end of file diff --git a/docs/analytics/umami.md b/docs/analytics/umami.md new file mode 100644 index 000000000..9cf38c2c7 --- /dev/null +++ b/docs/analytics/umami.md @@ -0,0 +1,7 @@ +# Umami + +```toml +[params.umami] + siteID = "ABCDE" + serverURL = "analytics.example.com" +``` diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 1b5e61bfa..bc93aa0b3 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,9 +1,10 @@ - - {{ block "title" . }}{{ .Site.Title }}{{ end }} - {{ partial "head.html" . }} - + + + {{ block "title" . }}{{ .Site.Title }}{{ end }} + {{ partial "head.html" . }} + {{ $csClass := "colorscheme-light" }} {{ if eq .Site.Params.colorScheme "dark" }} @@ -25,7 +26,8 @@ {{ if .HasShortcode "mermaid" }} - + @@ -102,7 +104,11 @@ {{- partial "analytics/yandex-metrika" . -}} {{ end }} + {{ if and .Site.Params.umami .Site.Params.umami.siteID }} + {{- partial "analytics/umami" . -}} + {{ end }} + {{- partial "body/extensions" . -}} - + \ No newline at end of file diff --git a/layouts/partials/analytics/umami.html b/layouts/partials/analytics/umami.html new file mode 100644 index 000000000..05f7445d9 --- /dev/null +++ b/layouts/partials/analytics/umami.html @@ -0,0 +1,4 @@ + + + \ No newline at end of file