ソースを参照

Add Pirsch analytics (#795)

### Prerequisites

Put an `x` into the box(es) that apply:

- [ ] This pull request fixes a bug.
- [x] This pull request adds a feature.
- [ ] This pull request introduces breaking change.

### Description

Adds support for [Pirsch](https://pirsch.io) analytics.

One of the best privacy-friendly, open source and lightweight analytics
providers.

### Issues Resolved

N/A

### Checklist

Put an `x` into the box(es) that apply:

#### General

- [x] Describe what changes are being made
- [x] Explain why and how the changes were necessary and implemented
respectively
- [ ] Reference issue with `#<ISSUE_NO>` if applicable

#### Resources

- [ ] If you have changed any SCSS code, run `make release` to
regenerate all CSS files

#### Contributors

- [ ] Add yourself to `CONTRIBUTORS.md` if you aren't on it already

Signed-off-by: Nour Agha <nour@agha.dev>
Co-authored-by: Luiz F. A. de Prá <luizdepra@users.noreply.github.com>
Nour Agha 2 年 前
コミット
d336b3cc3a

+ 1 - 0
docs/analytics.md

@@ -12,6 +12,7 @@
 * [Goat Counter](https://www.goatcounter.com/) - [documentation](/docs/analytics/goatcounter.md)
 * [Matomo](https://matomo.org/) - [documentation](/docs/analytics/matomo.md)
 * [Micro Analytics](https://microanalytics.io/) - [documentation](/docs/analytics/microanalytics.md)
+* [Pirsch](https://pirsch.io/) - [documentation](/docs/analytics/pirsch.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)

+ 6 - 0
docs/analytics/pirsch.md

@@ -0,0 +1,6 @@
+# Pirsch
+
+```toml
+[params.pirsch]
+  code = "ABCDE"
+```

+ 4 - 0
exampleSite/config.toml

@@ -88,6 +88,10 @@ customRemoteJS = []
 # id = "ABCDE"
 # dnt = "false" # respect DNT tracker, "true" by default
 
+# If you want to use Pirsch(https://pirsch.io) for analytics, add this section
+# [params.pirsch]
+# code = "ABCDE"
+
 # If you want to implement a Content-Security-Policy, add this section
 # [params.csp]
 # childsrc = ["'self'"]

+ 4 - 0
layouts/_default/baseof.html

@@ -108,6 +108,10 @@
   {{- partial "analytics/umami" . -}}
   {{ end }}
 
+  {{ if and .Site.Params.pirsch .Site.Params.pirsch.code }}
+  {{- partial "analytics/pirsch" . -}}
+  {{ end }}
+
   {{- partial "body/extensions" . -}}
 </body>
 

+ 3 - 0
layouts/partials/analytics/pirsch.html

@@ -0,0 +1,3 @@
+<script async defer type="text/javascript" src="https://api.pirsch.io/pirsch.js"
+    id="pirschjs"
+    data-code="{{ .Site.Params.pirsch.code }}"></script>