Hugo Plausible Analytics Module

Plausible is a lightweight and open-source Google Analytics alternative.

Modulegithub.com/hugomods/plausible-analytics
StatsGitHub Stars Used By Used By Used By Used By

Installation

Import the Module

1module:
2  imports:
3  - path: github.com/hugomods/plausible-analytics
1[module]
2  [[module.imports]]
3    path = 'github.com/hugomods/plausible-analytics'
1{
2   "module": {
3      "imports": [
4         {
5            "path": "github.com/hugomods/plausible-analytics"
6         }
7      ]
8   }
9}

Import the Template

1{{ partial "plausible-analytics/assets/js" . }}

Site Configuration

params.plausible_analytics.endpoint

NameContextTypeRequiredDefaultSinceExample
params.plausible_analytics.endpoint-string-https://plausible.io--

The endpoint of Plausible Analytics.

params.plausible_analytics.file_downloads

NameContextTypeRequiredDefaultSinceExample
params.plausible_analytics.file_downloads-boolean-false--

Whether to track file downloads.

NameContextTypeRequiredDefaultSinceExample
params.plausible_analytics.outbound_links-boolean-false--

Whether to track clicks on outbound links.

params.plausible_analytics.local

NameContextTypeRequiredDefaultSinceExample
params.plausible_analytics.local-boolean-false--

When true, track on localhost.

Site Configuration Example

hugo.yaml

1params:
2  plausible_analytics:
3    endpoint: https://plausible.io
4    file_downloads: false
5    local: false
6    outbound_links: false

hugo.toml

1[params]
2  [params.plausible_analytics]
3    endpoint = 'https://plausible.io'
4    file_downloads = false
5    local = false
6    outbound_links = false

hugo.json

 1{
 2   "params": {
 3      "plausible_analytics": {
 4         "endpoint": "https://plausible.io",
 5         "file_downloads": false,
 6         "local": false,
 7         "outbound_links": false
 8      }
 9   }
10}

Page Parameters

analyze

NameContextTypeRequiredDefaultSinceExample
analyze-boolean-true--

Exclude pages from being tracked if false.

plausible_analytics.file_downloads

NameContextTypeRequiredDefaultSinceExample
plausible_analytics.file_downloads-boolean----

Whether to track file downloads.

NameContextTypeRequiredDefaultSinceExample
plausible_analytics.outbound_links-boolean----

Whether to track clicks on outbound links.

Page Parameters Example

1analyze: true
2plausible_analytics:
3  file_downloads: false
4  outbound_links: false
1analyze = true
2[plausible_analytics]
3  file_downloads = false
4  outbound_links = false
1{
2   "analyze": true,
3   "plausible_analytics": {
4      "file_downloads": false,
5      "outbound_links": false
6   }
7}