Skip to content

Commit 33117d8

Browse files
authored
Add support for Swetrix, a GDPR-compliant analytics provider (#5344)
* add Swetrix as an analytics providers option * mention Swetrix support in README.md * add analytics provider option Swetrix to the documentation
1 parent 646ec82 commit 33117d8

File tree

5 files changed

+65
-37
lines changed

5 files changed

+65
-37
lines changed

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,36 @@ Minimal Mistakes is a flexible two-column Jekyll theme, perfect for building per
2727
- Optional [header images](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#headers), [custom sidebars](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#sidebars), [table of contents](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#table-of-contents), [galleries](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#gallery), related posts, [breadcrumb links](https://mmistakes.github.io/minimal-mistakes/docs/configuration/#breadcrumb-navigation-beta), [navigation lists](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#navigation-list), and more.
2828
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), Google+, [Discourse](https://www.discourse.org/), static-based via [Staticman](https://staticman.net/), [utterances](https://utteranc.es/), and [giscus](https://giscus.app/)).
2929
- [Google Analytics](https://www.google.com/analytics/) support.
30+
- [Swetrix](https://swetrix.com/) GDPR-compliant analytics support.
3031
- UI localized text in English (default), Arabic (عربي), Brazilian Portuguese (Português brasileiro), Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, Finnish, French (Français), German (Deutsch), Greek, Hebrew, Hindi (हिंदी), Hungarian, Indonesian, Irish (Gaeilge), Italian (Italiano), Japanese, Kiswahili, Korean, Malayalam, Myanmar (Burmese), Nepali (Nepalese), Norwegian (Norsk), Persian (فارسی), Polish, Punjabi (ਪੰਜਾਬੀ), Romanian, Russian, Slovak, Spanish (Español), Swedish, Thai, Turkish (Türkçe), Ukrainian (Українська) and Vietnamese.
3132

3233
## Skins (color variations)
3334

3435
This theme comes in nine different skins (in addition to the default one).
3536

36-
| `air` | `contrast` | `dark` |
37-
| --- | --- | --- |
37+
| `air` | `contrast` | `dark` |
38+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3839
| [![air skin](https://mmistakes.github.io/minimal-mistakes/assets/images/air-skin-archive.png)](https://mmistakes.github.io/minimal-mistakes/assets/images/air-skin-archive-large.png) | [![contrast skin](https://mmistakes.github.io/minimal-mistakes/assets/images/contrast-skin-archive.png)](https://mmistakes.github.io/minimal-mistakes/assets/images/contrast-skin-archive-large.png) | [![dark skin](https://mmistakes.github.io/minimal-mistakes/assets/images/dark-skin-archive.png)](https://mmistakes.github.io/minimal-mistakes/assets/images/dark-skin-archive-large.png) |
3940

40-
| `dirt` | `mint` | `sunrise` |
41-
| --- | --- | --- |
41+
| `dirt` | `mint` | `sunrise` |
42+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
4243
| [![dirt skin](https://mmistakes.github.io/minimal-mistakes/assets/images/dirt-skin-archive.png)](https://mmistakes.github.io/minimal-mistakes/assets/images/dirt-skin-archive-large.png) | [![mint skin](https://mmistakes.github.io/minimal-mistakes/assets/images/mint-skin-archive.png)](https://mmistakes.github.io/minimal-mistakes/assets/images/mint-skin-archive-large.png) | [![sunrise skin](https://mmistakes.github.io/minimal-mistakes/assets/images/sunrise-skin-archive.png)](https://mmistakes.github.io/minimal-mistakes/assets/images/sunrise-skin-archive-large.png) |
4344

44-
| `aqua` | `neon` | `plum` |
45-
| --- | --- | --- |
45+
| `aqua` | `neon` | `plum` |
46+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
4647
| [![aqua skin](https://mmistakes.github.io/minimal-mistakes/assets/images/aqua-skin-archive.png)](https://mmistakes.github.io/minimal-mistakes/assets/images/aqua-skin-archive-large.png) | [![neon skin](https://mmistakes.github.io/minimal-mistakes/assets/images/neon-skin-archive.png)](https://mmistakes.github.io/minimal-mistakes/assets/images/neon-skin-archive-large.png) | [![plum skin](https://mmistakes.github.io/minimal-mistakes/assets/images/plum-skin-archive.png)](https://mmistakes.github.io/minimal-mistakes/assets/images/plum-skin-archive-large.png) |
4748

4849
## Demo pages
4950

50-
| Name | Description |
51-
| ------------------------------------------- | ----------------------------------------------------- |
52-
| [Post with Header Image][header-image-post] | A post with a large header image. |
51+
| Name | Description |
52+
| ----------------------------------------------- | ------------------------------------------------------------- |
53+
| [Post with Header Image][header-image-post] | A post with a large header image. |
5354
| [HTML Tags and Formatting Post][html-tags-post] | A variety of common markup showing how the theme styles them. |
54-
| [Syntax Highlighting Post][syntax-post] | Post displaying highlighted code. |
55-
| [Post with a Gallery][gallery-post] | A post showing several images wrapped in `<figure>` elements. |
56-
| [Sample Collection Page][sample-collection] | Single page from a collection. |
57-
| [Categories Archive][categories-archive] | Posts grouped by category. |
58-
| [Tags Archive][tags-archive] | Posts grouped by tag. |
55+
| [Syntax Highlighting Post][syntax-post] | Post displaying highlighted code. |
56+
| [Post with a Gallery][gallery-post] | A post showing several images wrapped in `<figure>` elements. |
57+
| [Sample Collection Page][sample-collection] | Single page from a collection. |
58+
| [Categories Archive][categories-archive] | Posts grouped by category. |
59+
| [Tags Archive][tags-archive] | Posts grouped by tag. |
5960

6061
Additional sample posts are available under [posts archive][year-archive] on the demo site. Source files for these (and the entire demo site) can be found in [`/docs`](docs).
6162

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script src="https://swetrix.org/swetrix.js" defer></script>
2+
<script>
3+
document.addEventListener("DOMContentLoaded", function () {
4+
swetrix.init("{{ site.analytics.swetrix.tracking_id }}");
5+
swetrix.trackViews();
6+
});
7+
</script>
8+
9+
<noscript>
10+
<img
11+
src="https://api.swetrix.com/log/noscript?pid={{ site.analytics.swetrix.tracking_id }}"
12+
alt=""
13+
referrerpolicy="no-referrer-when-downgrade"
14+
/>
15+
</noscript>

_includes/analytics.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
{% include /analytics-providers/google-universal.html %}
88
{% when "google-gtag" %}
99
{% include /analytics-providers/google-gtag.html %}
10+
{% when "swetrix" %}
11+
{% include /analytics-providers/swetrix.html %}
1012
{% when "custom" %}
1113
{% include /analytics-providers/custom.html %}
1214
{% endcase %}

docs/_docs/02-structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ minimal-mistakes
1616
| ├── navigation.yml # main navigation links
1717
| └── ui-text.yml # text used throughout the theme's UI
1818
├── _includes
19-
| ├── analytics-providers # snippets for analytics (Google and custom)
19+
| ├── analytics-providers # snippets for analytics (Google, Swetrix, and custom)
2020
| ├── comments-providers # snippets for comments
2121
| ├── footer
2222
| | └── custom.html # custom snippets to add to site footer

docs/_docs/05-configuration.md

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -862,12 +862,13 @@ social:
862862

863863
Analytics is disabled by default. To enable globally select one of the following:
864864

865-
| Name | Analytics Provider |
866-
| -------------------- | --------------------------------------------------------------- |
867-
| **google** | [Google Standard Analytics](https://www.google.com/analytics/) |
868-
| **google-universal** | [Google Universal Analytics](https://www.google.com/analytics/) |
865+
| Name | Analytics Provider |
866+
| -------------------- | --------------------------------------------------------------------- |
867+
| **google** | [Google Standard Analytics](https://www.google.com/analytics/) |
868+
| **google-universal** | [Google Universal Analytics](https://www.google.com/analytics/) |
869869
| **google-gtag** | [Google Analytics Global Site Tag](https://www.google.com/analytics/) |
870-
| **custom** | Other analytics providers |
870+
| **swetrix** | [Swetrix](https://swetrix.com/) GDPR-compliant analytics |
871+
| **custom** | Other analytics providers |
871872

872873
For Google Analytics add your Tracking Code:
873874

@@ -879,6 +880,15 @@ analytics:
879880
anonymize_ip: false # default
880881
```
881882

883+
For Swetrix Analytics add your Tracking ID:
884+
885+
```yaml
886+
analytics:
887+
provider: "swetrix"
888+
swetrix:
889+
tracking_id: "xyz43567EF"
890+
```
891+
882892
To use another provider not included with the theme set `provider: "custom"` then add their embed code to `_includes/analytics-providers/custom.html`.
883893

884894
**Note:** Analytics are disabled in `development`. To enable when testing/building locally be sure to set
@@ -904,11 +914,11 @@ author:
904914

905915
Author links are all optional, include the ones you want visible under the `author.links` array.
906916

907-
| Name | Description |
908-
| --- | --- |
909-
| **label** | Link label (e.g. `"Twitter"`) |
910-
| **icon** | [Font Awesome icon](https://fontawesome.com/v6/search) classes (e.g. `"fab fa-fw fa-twitter-square"`) |
911-
| **url** | Link URL (e.g. `"https://twitter.com/mmistakes"`) |
917+
| Name | Description |
918+
| --------- | ----------------------------------------------------------------------------------------------------- |
919+
| **label** | Link label (e.g. `"Twitter"`) |
920+
| **icon** | [Font Awesome icon](https://fontawesome.com/v6/search) classes (e.g. `"fab fa-fw fa-twitter-square"`) |
921+
| **url** | Link URL (e.g. `"https://twitter.com/mmistakes"`) |
912922

913923
```yaml
914924
author:
@@ -937,11 +947,11 @@ To customize the author sidebar, read the full [layout documentation]({{ "/docs/
937947

938948
Footer links can be added under the `footer.links` array.
939949

940-
| Name | Description |
941-
| --- | --- |
942-
| **label** | Link label (e.g. `"Twitter"`) |
943-
| **icon** | [Font Awesome icon](https://fontawesome.com/v6/search) classes (e.g. `"fab fa-fw fa-twitter-square"`) |
944-
| **url** | Link URL (e.g. `"https://twitter.com/mmistakes"`) |
950+
| Name | Description |
951+
| --------- | ----------------------------------------------------------------------------------------------------- |
952+
| **label** | Link label (e.g. `"Twitter"`) |
953+
| **icon** | [Font Awesome icon](https://fontawesome.com/v6/search) classes (e.g. `"fab fa-fw fa-twitter-square"`) |
954+
| **url** | Link URL (e.g. `"https://twitter.com/mmistakes"`) |
945955

946956
```yaml
947957
footer:
@@ -1131,13 +1141,13 @@ timezone: America/New_York
11311141

11321142
When hosting with GitHub Pages a small [set of gems](https://pages.github.com/versions/) have been whitelisted for use. The theme uses a few of them which can be found under `gems`. Additional settings and configurations are documented in the links below.
11331143

1134-
| Plugin | Description |
1135-
| --- | --- |
1136-
| [jekyll-paginate][jekyll-paginate] | Pagination Generator for Jekyll. |
1137-
| [jekyll-sitemap][jekyll-sitemap] | Jekyll plugin to silently generate a sitemaps.org compliant sitemap for your Jekyll site. |
1138-
| [jekyll-gist][jekyll-gist] | Liquid tag for displaying GitHub Gists in Jekyll sites. |
1139-
| [jekyll-feed][jekyll-feed] | A Jekyll plugin to generate an Atom (RSS-like) feed of your Jekyll posts. |
1140-
| [jekyll-include-cache][jekyll-include-cache] | Liquid tag that caches Liquid includes. |
1144+
| Plugin | Description |
1145+
| -------------------------------------------- | ----------------------------------------------------------------------------------------- |
1146+
| [jekyll-paginate][jekyll-paginate] | Pagination Generator for Jekyll. |
1147+
| [jekyll-sitemap][jekyll-sitemap] | Jekyll plugin to silently generate a sitemaps.org compliant sitemap for your Jekyll site. |
1148+
| [jekyll-gist][jekyll-gist] | Liquid tag for displaying GitHub Gists in Jekyll sites. |
1149+
| [jekyll-feed][jekyll-feed] | A Jekyll plugin to generate an Atom (RSS-like) feed of your Jekyll posts. |
1150+
| [jekyll-include-cache][jekyll-include-cache] | Liquid tag that caches Liquid includes. |
11411151

11421152
[jekyll-paginate]: https://github.com/jekyll/jekyll-paginate
11431153
[jekyll-sitemap]: https://github.com/jekyll/jekyll-sitemap

0 commit comments

Comments
 (0)