Skip to content

Commit

Permalink
feat: update config for Google Analytics (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-baiborodine authored Jul 29, 2024
1 parent 837f875 commit f8c5529
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
19 changes: 7 additions & 12 deletions v4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -697,18 +697,13 @@ The second option is to use the `audio` shortcode within markdown content in a p

Bilberry theme comes with built-in support for both v3 and v4
of [Google Analytics](https://analytics.google.com/analytics/web/).
You should set the value of the `googleAnalytics` property in the `hugo.toml` file to enable it.

Such value for Universal Analytics v3 is prefixed with the `UA` letters.
So, suppose you migrate your existing website to the Bilberry theme, and your website is already tracked in Universal
Analytics, given that the corresponding property was created before October 14, 2020.
In that case, you should continue using the v3 value in the `hugo.toml` file.
However given that Universal Analytics will no longer process new data in standard properties beginning July 1, 2023, you
will have to create a Google Analytics v4 property linked to your v3 property.

If you created your property after October 14, 2020, you're likely using a Google Analytics v4 property already, and the
value for such property is prefixed with the `G` letter.
In that case, you should use the v4 value in the `hugo.toml` file.
To enable it, set the value of the `services.googleAnalytics.ID` property in the `hugo.toml`.

```yaml
[services]
[services.googleAnalytics]
ID = 'G-XXXXXXXXXX'
```

### Comments

Expand Down
7 changes: 4 additions & 3 deletions v4/exampleSite/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ enableRobotsTXT = true
# Change to one of your content languages defined at the end.
DefaultContentLanguage = "en"

# Enable / Disable Google Analytics statistics for your site
googleAnalytics = ""

# Enable / Disable comments on the articles via Disqus.
disqusShortname = ""

Expand Down Expand Up @@ -162,6 +159,10 @@ disqusShortname = ""
creditsText = "Bilberry Hugo Theme"
creditsUrl = "https://github.com/Lednerb/bilberry-hugo-theme"

# Enable/Disable Google Analytics statistics for your site
[services]
[services.googleAnalytics]
ID = ''

# customize your available languages for your multilingual site
# or delete one of the [languages.xx] blocks to use the theme with only one supported language
Expand Down
7 changes: 4 additions & 3 deletions v4/tests/exampleSite/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ enableRobotsTXT = true
# Change to one of your content languages defined at the end.
DefaultContentLanguage = "en"

# Enable / Disable Google Analytics statistics for your site
googleAnalytics = ""

# Enable / Disable comments on the articles via Disqus.
disqusShortname = "bilberry-hugo-theme"

Expand Down Expand Up @@ -138,6 +135,10 @@ disqusShortname = "bilberry-hugo-theme"
creditsText = "Bilberry Hugo Theme"
creditsUrl = "https://github.com/Lednerb/bilberry-hugo-theme"

# Enable/Disable Google Analytics statistics for your site
[services]
[services.googleAnalytics]
ID = ''

# customize your available languages for your multilingual site
# or delete the [languages] blog to use the theme with only one supported language
Expand Down

0 comments on commit f8c5529

Please sign in to comment.