Become a backer or sponsor to support our work.
This module add Plausible Analytics for Hugo and HugoPress.
Module |
---|
github.com/hugomods/plausible-analytics |
hugo.yaml
1module:
2 imports:
3 - path: github.com/hugomods/plausible-analytics
hugo.toml
1[module]
2 [[module.imports]]
3 path = 'github.com/hugomods/plausible-analytics'
hugo.json
1{
2 "module": {
3 "imports": [
4 {
5 "path": "github.com/hugomods/plausible-analytics"
6 }
7 ]
8 }
9}
Note
Please skip this step if your theme supports HugoPress, such as HB Framework themes.
1{{ partial "plausible-analytics/assets/js" . }}
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
endpoint | string | - | https://plausible.io | The endpoint of Plausible Analytics. |
file_downloads | boolean | - | false | Whether to track file downloads. |
outbound_links | boolean | - | false | Whether to track clicks on outbound links. |
local | boolean | - | false | When true , track on localhost . |
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}
You can also override the site configuration on specified pages by setting following parameters on front matter.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
file_downloads | boolean | - | Site settings. | Whether to track file downloads. |
outbound_links | boolean | - | Site settings. | Whether to track clicks on outbound links. |
analyze | boolean | - | true | Exclude pages from being tracked if false . |
1plausible_analytics:
2 analyze: true
3 file_downloads: false
4 outbound_links: false
1[plausible_analytics]
2 analyze = true
3 file_downloads = false
4 outbound_links = false
1{
2 "plausible_analytics": {
3 "analyze": true,
4 "file_downloads": false,
5 "outbound_links": false
6 }
7}