Skip to content

Commit

Permalink
Add Pirsch analytics (#795)
Browse files Browse the repository at this point in the history
### 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>
  • Loading branch information
nourkagha and luizdepra committed Apr 9, 2023
1 parent 7627f13 commit d336b3c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 6 additions & 0 deletions docs/analytics/pirsch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Pirsch

```toml
[params.pirsch]
code = "ABCDE"
```
4 changes: 4 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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'"]
Expand Down
4 changes: 4 additions & 0 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
3 changes: 3 additions & 0 deletions layouts/partials/analytics/pirsch.html
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit d336b3c

Please sign in to comment.