From f8c5529987f7d4b53344b8dc0b173aa39ebc5a70 Mon Sep 17 00:00:00 2001 From: Igor Baiborodine Date: Mon, 29 Jul 2024 15:39:53 -0400 Subject: [PATCH] feat: update config for Google Analytics (#650) --- v4/README.md | 19 +++++++------------ v4/exampleSite/hugo.toml | 7 ++++--- v4/tests/exampleSite/hugo.toml | 7 ++++--- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/v4/README.md b/v4/README.md index 05b5f9e5..15804d3d 100644 --- a/v4/README.md +++ b/v4/README.md @@ -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 diff --git a/v4/exampleSite/hugo.toml b/v4/exampleSite/hugo.toml index ce1b719f..83460d61 100644 --- a/v4/exampleSite/hugo.toml +++ b/v4/exampleSite/hugo.toml @@ -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 = "" @@ -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 diff --git a/v4/tests/exampleSite/hugo.toml b/v4/tests/exampleSite/hugo.toml index d92f41d3..607c3625 100644 --- a/v4/tests/exampleSite/hugo.toml +++ b/v4/tests/exampleSite/hugo.toml @@ -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" @@ -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