Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update config for Google Analytics #650

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading