Skip to content

Commit

Permalink
feat(analytics): Add umami analytics (#787)
Browse files Browse the repository at this point in the history
### 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 `#<ISSUE_NO>` 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
  • Loading branch information
eastonman authored Mar 19, 2023
1 parent 5ad4522 commit c8e6aa6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions docs/analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 7 additions & 0 deletions docs/analytics/umami.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Umami

```toml
[params.umami]
siteID = "ABCDE"
serverURL = "analytics.example.com"
```
18 changes: 12 additions & 6 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}">
<head>
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
{{ partial "head.html" . }}
</head>

<head>
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
{{ partial "head.html" . }}
</head>

{{ $csClass := "colorscheme-light" }}
{{ if eq .Site.Params.colorScheme "dark" }}
Expand All @@ -25,7 +26,8 @@
</main>

{{ if .HasShortcode "mermaid" }}
<script src="https://cdn.jsdelivr.net/npm/mermaid@9.3.0/dist/mermaid.min.js" integrity="sha256-QdTG1YTLLTwD3b95jLqFxpQX9uYuJMNAtVZgwKX4oYU=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid@9.3.0/dist/mermaid.min.js"
integrity="sha256-QdTG1YTLLTwD3b95jLqFxpQX9uYuJMNAtVZgwKX4oYU=" crossorigin="anonymous"></script>
<script>
mermaid.initialize({ startOnLoad: true });
</script>
Expand Down Expand Up @@ -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" . -}}
</body>

</html>
</html>
4 changes: 4 additions & 0 deletions layouts/partials/analytics/umami.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- Umami Analytics START -->
<script async defer data-website-id="{{ .Site.Params.umami.websiteId }}"
src="{{ .Site.Params.umami.serverURL }}/umami.js"></script>
<!-- Umami Analytics END -->

0 comments on commit c8e6aa6

Please sign in to comment.