From d48f0cf0fb6b39dd51b53a535427c1c9d8ebe38f Mon Sep 17 00:00:00 2001 From: sylhare Date: Fri, 27 May 2022 12:25:48 -0400 Subject: [PATCH] Add dual tagging --- _includes/default/head.liquid | 1 + assets/js/partials/cookie_consent_init.js | 1 + 2 files changed, 2 insertions(+) diff --git a/_includes/default/head.liquid b/_includes/default/head.liquid index 03ccd34e3b..b4a4f03d17 100644 --- a/_includes/default/head.liquid +++ b/_includes/default/head.liquid @@ -57,6 +57,7 @@ const cookieName = 'cookie-notice-dismissed-{{ site.url }}'; const isCookieConsent = '{{ site.cookie_consent }}'; const analyticsName = '{{ site.google_analytics }}'; + const analyticsNameGA4 = '{{ site.google_analytics_ga4 }}'; {% if site.cookie_consent %} diff --git a/assets/js/partials/cookie_consent_init.js b/assets/js/partials/cookie_consent_init.js index 07685fbd17..3cea07ea49 100644 --- a/assets/js/partials/cookie_consent_init.js +++ b/assets/js/partials/cookie_consent_init.js @@ -35,6 +35,7 @@ function googleAnalytics() { function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', analyticsName); + gtag('config', analyticsNameGA4, { 'anonymize_ip': true }); // Google analytics window.ga = window.ga || function () { (ga.q = ga.q || []).push(arguments) };