From 96fdcc50bde51af98c8ded2890f4c45c2c801b6e Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Fri, 27 Sep 2024 14:17:24 +0200 Subject: Drop support of AnonymizeIp configuration parameter --- CHANGELOG.md | 2 ++ assets/js/ga.js | 3 +-- exampleSite/config/_default/params.yaml | 5 ----- layouts/partials/seo/ga.html | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 462cd11..f4bf3ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed explicit setting of the `languageCode` for the example site to force Hugo use `site.Language.LanguageCode` as the default language code for the site. See `exampleSite/config/_default/languages.yaml` for more details. +- Drop support of AnonymizeIp configuration parameter for Google Analytics as + it is no longer relevant in Google Analytics >= v4. ## [v0.8.0](https://github.com/sergeyklay/gohugo-theme-ed/compare/v0.7.0...v0.8.0) diff --git a/assets/js/ga.js b/assets/js/ga.js index c7a174c..6375501 100644 --- a/assets/js/ga.js +++ b/assets/js/ga.js @@ -1,4 +1,4 @@ -import {analyticsCode, anonymizeIp} from '@params'; +import {analyticsCode} from '@params'; let dataLayer; @@ -126,7 +126,6 @@ if (isDoNotTrackEnabled()) { // Setup the project analytics code and send a pageview gtag('config', analyticsCode, { - 'anonymize_ip': anonymizeIp, 'cookie_expires': month }); diff --git a/exampleSite/config/_default/params.yaml b/exampleSite/config/_default/params.yaml index 2ede17d..71eca84 100644 --- a/exampleSite/config/_default/params.yaml +++ b/exampleSite/config/_default/params.yaml @@ -83,11 +83,6 @@ seo: # The site.Title will be used if empty. publisher: Serghei Iakovlev - # To anonymize the IP addresses of hits sent to Google Analytics - # set this param to true. Please note, to enable Google Analytics - # you have to set `googleAnalytics` param in config.yaml file. - anonymizeIp: true - author: name: Serghei Iakovlev email: egrep@protonmail.ch diff --git a/layouts/partials/seo/ga.html b/layouts/partials/seo/ga.html index 5fcde75..40758d8 100644 --- a/layouts/partials/seo/ga.html +++ b/layouts/partials/seo/ga.html @@ -1,6 +1,6 @@ {{- if (or (eq (getenv "HUGO_ENV") "production") (eq site.Params.env "production")) -}} {{- with site.GoogleAnalytics -}} - {{- $gaParams := dict "analyticsCode" (site.GoogleAnalytics | default "") "anonymizeIp" (site.Params.anonymizeIp | default true) -}} + {{- $gaParams := dict "analyticsCode" (site.GoogleAnalytics | default "") -}} {{- $gaScript := slice -}} {{- $gaScript = $gaScript | append (resources.Get "js/ga.js") -}} -- cgit v1.2.3