Przeglądaj źródła

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
Jarek Rozanski 2 lat temu
rodzic
commit
965c1cb752

+ 1 - 0
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)

+ 16 - 1
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)

+ 6 - 0
docs/analytics/applicationinsights.md

@@ -0,0 +1,6 @@
+# Application Insights
+
+```toml
+[params.applicationInsights]
+    connectionString = "connectionstring" # https://docs.microsoft.com/en-us/azure/azure-monitor/app/sdk-connection-string
+```

+ 6 - 0
docs/analytics/cloudflare.md

@@ -0,0 +1,6 @@
+# Cloudflare
+
+```toml
+[params.cloudflare]
+    token = "token"
+```

+ 7 - 0
docs/analytics/fathom.md

@@ -0,0 +1,7 @@
+# Fathom Analytics
+
+```toml
+[params.fathomAnalytics]
+  siteID = "ABCDE"
+  serverURL = "cdn.usefathom.com" # (optionnal) Replace if you use a custom domain
+```

+ 6 - 0
docs/analytics/goatcounter.md

@@ -0,0 +1,6 @@
+# Goat Counter
+
+```toml
+[params.goatCounter]
+  code = "code" # You will access your account at https://[code].goatcounter.com
+```

+ 3 - 0
docs/analytics/googleanalytics.md

@@ -0,0 +1,3 @@
+# Google Analytics
+
+Follow [these steps](https://gohugo.io/templates/internal/#configure-google-analytics).

+ 6 - 0
docs/analytics/googletagmanager.md

@@ -0,0 +1,6 @@
+# Google Tag Manager
+
+```toml
+[params.googleTagManager]
+    id = "gid"
+```

+ 7 - 0
docs/analytics/matomo.md

@@ -0,0 +1,7 @@
+# Matomo
+
+```toml
+[params.matomo]
+    siteID = "ABCDE"
+    serverURL = "analytics.example.com"
+```

+ 7 - 0
docs/analytics/microanalytics.md

@@ -0,0 +1,7 @@
+# microanalytics.io
+
+```toml
+[params.microAnalytics]
+    id = "ABCDE"
+    dnt = "false" # respect DNT tracker, "true" by default
+```

+ 7 - 0
docs/analytics/plausible.md

@@ -0,0 +1,7 @@
+# Plausible Analytics
+
+```toml
+[params.plausibleAnalytics]
+  domain = "example.com"
+  serverURL = "plausible.io" # (optionnal) Replace if you use a custom domain
+```

+ 25 - 0
docs/analytics/wideangle.md

@@ -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"
+```

+ 3 - 84
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.

+ 4 - 0
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 }}

+ 5 - 0
layouts/partials/analytics/wideangle.html

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