mirror of https://github.com/luizdepra/hugo-coder.git

Jarek Rozanski
08.25.2023 965c1cb752ad4deed04861e5e950a2b37f519adf
Wide Angle Analytics Support (#1) (#773)

### 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

✅ Normalize web analytics documentation with a page per vendor
✅ Add privacy-friendly Wide Angle Analytics support

### 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

- [x] Add yourself to `CONTRIBUTORS.md` if you aren't on it already
4 files modified
11 files added
194 ■■■■■ changed files
CONTRIBUTORS.md 1 ●●●● patch | view | raw | blame | history
docs/analytics.md 17 ●●●●● patch | view | raw | blame | history
docs/analytics/applicationinsights.md 6 ●●●●● patch | view | raw | blame | history
docs/analytics/cloudflare.md 6 ●●●●● patch | view | raw | blame | history
docs/analytics/fathom.md 7 ●●●●● patch | view | raw | blame | history
docs/analytics/goatcounter.md 6 ●●●●● patch | view | raw | blame | history
docs/analytics/googleanalytics.md 3 ●●●●● patch | view | raw | blame | history
docs/analytics/googletagmanager.md 6 ●●●●● patch | view | raw | blame | history
docs/analytics/matomo.md 7 ●●●●● patch | view | raw | blame | history
docs/analytics/microanalytics.md 7 ●●●●● patch | view | raw | blame | history
docs/analytics/plausible.md 7 ●●●●● patch | view | raw | blame | history
docs/analytics/wideangle.md 25 ●●●●● patch | view | raw | blame | history
docs/configurations.md 87 ●●●●● patch | view | raw | blame | history
layouts/_default/baseof.html 4 ●●●● patch | view | raw | blame | history
layouts/partials/analytics/wideangle.html 5 ●●●●● patch | view | raw | blame | history
CONTRIBUTORS.md
@@ -125,3 +125,4 @@
- [Martin Hellspong](https://github.com/marhel)
- [Robert Tucker](https://github.com/robertwtucker)
- [Michał Pawlik](https://michalp.net)
- [Jaroslaw Rozanski](https://jarekrozanski.eu)
docs/analytics.md
@@ -1 +1,16 @@
WIP
# Enable Web Analytics
## Supported Providers
*in alphabetic order*
* [Application Insights](https://azure.com/) - [documentation](/docs/analytics/applicationinsights.md)
* [Cloudflare](https://www.cloudflare.com/analytics/) - [documentation](/docs/analytics/cloudflare.md)
* [Google Analytics](https://developers.google.com/analytics) - [documentation](/docs/analytics/googleanalytics.md)
* [Google Tag Manager](https://developers.google.com/tag-manager) - [documentation](/docs/analytics/googletagmanager.md)
* [Fathom Analytics](https://usefathom.com/) - [documentation](/docs/analytics/fathom.md)
* [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)
* [Plausible Analytics](https://plausible.io/) - [documentation](/docs/analytics/plausible.md)
* [Wide Angle Analytics](https://wideangle.co/) - [documentation](/docs/analytics/wideangle.md)
docs/analytics/applicationinsights.md
New file
@@ -0,0 +1,6 @@
# Application Insights
```toml
[params.applicationInsights]
    connectionString = "connectionstring" # https://docs.microsoft.com/en-us/azure/azure-monitor/app/sdk-connection-string
```
docs/analytics/cloudflare.md
New file
@@ -0,0 +1,6 @@
# Cloudflare
```toml
[params.cloudflare]
    token = "token"
```
docs/analytics/fathom.md
New file
@@ -0,0 +1,7 @@
# Fathom Analytics
```toml
[params.fathomAnalytics]
  siteID = "ABCDE"
  serverURL = "cdn.usefathom.com" # (optionnal) Replace if you use a custom domain
```
docs/analytics/goatcounter.md
New file
@@ -0,0 +1,6 @@
# Goat Counter
```toml
[params.goatCounter]
  code = "code" # You will access your account at https://[code].goatcounter.com
```
docs/analytics/googleanalytics.md
New file
@@ -0,0 +1,3 @@
# Google Analytics
Follow [these steps](https://gohugo.io/templates/internal/#configure-google-analytics).
docs/analytics/googletagmanager.md
New file
@@ -0,0 +1,6 @@
# Google Tag Manager
```toml
[params.googleTagManager]
    id = "gid"
```
docs/analytics/matomo.md
New file
@@ -0,0 +1,7 @@
# Matomo
```toml
[params.matomo]
    siteID = "ABCDE"
    serverURL = "analytics.example.com"
```
docs/analytics/microanalytics.md
New file
@@ -0,0 +1,7 @@
# microanalytics.io
```toml
[params.microAnalytics]
    id = "ABCDE"
    dnt = "false" # respect DNT tracker, "true" by default
```
docs/analytics/plausible.md
New file
@@ -0,0 +1,7 @@
# Plausible Analytics
```toml
[params.plausibleAnalytics]
  domain = "example.com"
  serverURL = "plausible.io" # (optionnal) Replace if you use a custom domain
```
docs/analytics/wideangle.md
New file
@@ -0,0 +1,25 @@
# Wide Angle Analytics
Wide Angle Analytics is strictly **GDPR** compliant, privacy-first web analytics. Head to [wideangle.co](https://wideangle.co/) and create you free trial account now.
## Configuration
Built in template supports following configuration options:
param | description | required | dafault
------|-------------|----------|--------
siteID| A site ID from [Wide Angle site](https://wideangle.co/documentation/web-analytics-for-your-website)| :white_check_mark: | n/a
serverURL | [Domain](https://wideangle.co/documentation/track-with-custom-domain) with which the WAA is configured with | :x: | stats.wideangle.co
fingerprint | Enable advanced session fingerprint; requires user consent | :x: | false
supressDNT | Ignore Do-Not-Track setting in the browser | :x: | false
## Example
```toml
[params.wideAngleAnalytics]
  siteID = "1D4EG3B9ACA03F4243"
  serverURL = "fyi.wideangle.co"
  fingerprint = "false"
  supressDNT = "false"
```
docs/configurations.md
@@ -1,15 +1,7 @@
# Configurations
* [About Hugo Configurations](#about-hugo-configurations)
  * [Analytics](#analytics)
    * [Google Analytics](#google-analytics)
    * [Google Tag Manager](#google-tag-manager)
    * [Fathom Analytics](#fathom-analytics)
    * [Plausible Analytics](#plausible-analytics)
    * [Goat Counter](#goat-counter)
    * [Cloudflare](#cloudflare)
    * [Matomo](#matomo)
    * [Application Insights](#application-insights)
  * [Analytics](/docs/analytics.md)
  * [Commenting Systems](#commenting-systems)
    * [Disqus](#disqus)
    * [Commento](#commento)
@@ -27,87 +19,14 @@
This theme supports:
* Analytics
  * [Google Analytics](https://developers.google.com/analytics)
  * [Google Tag Manager](https://developers.google.com/tag-manager)
  * [Fathom Analytics](https://usefathom.com/)
  * [Plausible Analytics](https://plausible.io/)
  * [Goat Counter](https://www.goatcounter.com/)
  * [Cloudflare](https://www.cloudflare.com/analytics/)
  * [Matomo](https://matomo.org/)
  * [Application Insights](https://azure.com/)
* [Analytics](/docs/analytics.md)
* Commenting Systems
  * [Disqus](https://disqus.com/)
  * [Commento](https://commento.io/)
  * [Utterances](https://utteranc.es/)
  * [Giscus](https://giscus.app/)
### Analytics
#### Google Analytics
Follow [these steps](https://gohugo.io/templates/internal/#configure-google-analytics).
#### Google Tag Manager
```toml
[params.googleTagManager]
    id = "gid"
```
#### Fathom Analytics
```toml
[params.fathomAnalytics]
  siteID = "ABCDE"
  serverURL = "cdn.usefathom.com" # (optionnal) Replace if you use a custom domain
```
#### Plausible Analytics
```toml
[params.plausibleAnalytics]
  domain = "example.com"
  serverURL = "plausible.io" # (optionnal) Replace if you use a custom domain
```
#### Goat Counter
```toml
[params.goatCounter]
  code = "code" # You will access your account at https://[code].goatcounter.com
```
#### Cloudflare
```toml
[params.cloudflare]
    token = "token"
```
#### Matomo
```toml
[params.matomo]
    siteID = "ABCDE"
    serverURL = "analytics.example.com"
```
#### Application Insights
```toml
[params.applicationInsights]
    connectionString = "connectionstring" # https://docs.microsoft.com/en-us/azure/azure-monitor/app/sdk-connection-string
```
#### microanalytics.io
```toml
[params.microAnalytics]
    id = "ABCDE"
    dnt = "false" # respect DNT tracker, "true" by default
```
### Commenting Systems
Comments are displayed within post pages, but can be disabled with `disableComments` front-matter.
layouts/_default/baseof.html
@@ -78,6 +78,10 @@
  {{- partial "analytics/cloudflare" . -}}
  {{ end }}
  {{ if and .Site.Params.wideAngleAnalytics .Site.Params.wideAngleAnalytics.siteID }}
  {{- partial "analytics/wideangle" . -}}
  {{ end }}
  {{ if and .Site.Params.matomo .Site.Params.matomo.serverURL }}
  {{- partial "analytics/matomo" . -}}
  {{ end }}
layouts/partials/analytics/wideangle.html
New file
@@ -0,0 +1,5 @@
<script async defer
  src='https://{{ .Site.Params.wideAngleAnalytics.serverURL | default "stats.wideangle.co" }}/script/{{ .Site.Params.wideAngleAnalytics.siteID}}.js'
  data-waa-fingerprint='{{ .Site.Params.wideAngleAnalytics.fingerprint | default "false" }}'
  data-waa-dnt-supress='{{ .Site.Params.wideAngleAnalytics.supressDNT | default "false" }}'>
</script>