Minimal Google Analytics record page views, site searches, scrolls and file downloads on your website without loading official, heavy tracking library.
Become a backer or sponsor to support our work.
| Module | github.com/hugomods/minimal-google-analytics | 
|---|---|
| Stats | 
1module:
2  imports:
3  - path: github.com/hugomods/minimal-google-analytics
1[module]
2  [[module.imports]]
3    path = 'github.com/hugomods/minimal-google-analytics'
1{
2   "module": {
3      "imports": [
4         {
5            "path": "github.com/hugomods/minimal-google-analytics"
6         }
7      ]
8   }
9}
Note
Please skip this step if your theme supports HugoPress, such as HB Framework themes.
1<head>
2  {{ partialCached "hugomods/minimal-google-analytics/index" . .Params.analyze }}
3</head>
services.googleAnalytics.ID| Name | Context | Type | Required | Default | Since | Example | 
|---|---|---|---|---|---|---|
| services.googleAnalytics.ID | - | string | - | - | - | G-XXXXXXXX | 
The measurement ID.
hugo.yaml
1services:
2  googleAnalytics:
3    ID: G-XXXXXXXXXX
hugo.toml
1[services]
2  [services.googleAnalytics]
3    ID = 'G-XXXXXXXXXX'
hugo.json
1{
2   "services": {
3      "googleAnalytics": {
4         "ID": "G-XXXXXXXXXX"
5      }
6   }
7}
analyze| Name | Context | Type | Required | Default | Since | Example | 
|---|---|---|---|---|---|---|
| analyze | - | boolean | - | true | - | - | 
Exclude pages from being tracked if false.