From 6ccdf4baf0ee8a0a81a157ab30dedb4892db5b82 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 20 Aug 2025 15:02:53 -0300 Subject: [PATCH 1/9] Initial implementation with Klaro. --- env.template | 3 +- gatsby-browser.js | 26 ++- gatsby-config.js | 94 +++++---- package.json | 4 +- src/utils/EventEmitter.js | 26 +++ src/utils/cookies/CookieManager.js | 27 +++ src/utils/cookies/CookieManagerProvider.js | 15 ++ src/utils/cookies/providers/KlaroProvider.js | 81 ++++++++ src/utils/cookies/services.js | 30 +++ src/utils/dataNormalization.js | 36 ++++ src/utils/envVariables.js | 3 + src/utils/eventTriggers.js | 19 ++ src/utils/hooks/index.js | 6 + src/utils/hooks/useEventListener.js | 15 ++ src/utils/tag-manager/TagManager.js | 41 ++++ src/utils/tag-manager/TagManagerProvider.js | 7 + .../providers/GoogleTagManagerProvider.js | 49 +++++ yarn.lock | 194 +++++++++++++++--- 18 files changed, 593 insertions(+), 83 deletions(-) create mode 100644 src/utils/EventEmitter.js create mode 100644 src/utils/cookies/CookieManager.js create mode 100644 src/utils/cookies/CookieManagerProvider.js create mode 100644 src/utils/cookies/providers/KlaroProvider.js create mode 100644 src/utils/cookies/services.js create mode 100644 src/utils/dataNormalization.js create mode 100644 src/utils/eventTriggers.js create mode 100644 src/utils/hooks/index.js create mode 100644 src/utils/hooks/useEventListener.js create mode 100644 src/utils/tag-manager/TagManager.js create mode 100644 src/utils/tag-manager/TagManagerProvider.js create mode 100644 src/utils/tag-manager/providers/GoogleTagManagerProvider.js diff --git a/env.template b/env.template index d56808c08..a481221ab 100644 --- a/env.template +++ b/env.template @@ -14,4 +14,5 @@ GATSBY_TURNSTILE_SITE_KEY= GATSBY_TURNSTILE_SECRET_KEY= GATSBY_TURNSTILE_API_URL=https://challenges.cloudflare.com/turnstile/v0/siteverify GATSBY_ELECTION_SINCE_YEAR= -GATSBY_ELECTION_TO_SHOW= \ No newline at end of file +GATSBY_ELECTION_TO_SHOW= +GOOGLE_TAGMANAGER_ID= diff --git a/gatsby-browser.js b/gatsby-browser.js index 8cc15e1ee..e3827da7e 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -1,6 +1,13 @@ import { browserWrapper } from "./src/state/ReduxWrapper" +import CookieManager from "./src/utils/cookies/CookieManager"; +import KlaroProvider from "./src/utils/cookies/providers/KlaroProvider"; +import cookieServices from "./src/utils/cookies/services"; +import TagManager from "./src/utils/tag-manager/TagManager"; +import GoogleTagManagerProvider from "./src/utils/tag-manager/providers/GoogleTagManagerProvider"; +import smoothscroll from 'smoothscroll-polyfill' + // @see wrapRootElement export const wrapRootElement = browserWrapper; @@ -12,4 +19,21 @@ window.SPONSORED_PROJECT_ID = process.env.GATSBY_SPONSORED_PROJECT_ID export const onRouteUpdate = ({ location, prevLocation }) => { -} \ No newline at end of file +} + +export const onClientEntry = () => { + // var set at document level + // prevents widget color flashing from defaults to fetched by widget from marketing api + // smooth scroll polyfill needed for Safari + smoothscroll.polyfill(); + + // Initialize TagManager and add GoogleTagManagerProvider + const tagManager = new TagManager(); + const googleTagManagerProvider = new GoogleTagManagerProvider(); + tagManager.addProvider(googleTagManagerProvider); + + // Initialize Cookie Manager with Klaro provider + const klaroProvider = new KlaroProvider(); + const cookieManager = new CookieManager(klaroProvider, cookieServices); + cookieManager.show(); +}; diff --git a/gatsby-config.js b/gatsby-config.js index c3055a86a..3e4dc91ba 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,14 +1,32 @@ -module.exports = { - flags: { - FAST_DEV: true, - DEV_SSR: false - }, - siteMetadata: { - title: "OpenInfra Foundation", - description: "The Home of Open Infrastructure", - url: "https://openinfra.dev/" +const googleTagManagerPlugin = [ + { + resolve: "gatsby-plugin-google-gtag", + options: { + // You can add multiple tracking ids and a pageview event will be fired for all of them. + trackingIds: [ + "UA-139234657-1", // Google Analytics / GA, + ], + // This object gets passed directly to the gtag config command + // This config will be shared across all trackingIds + gtagConfig: { + anonymize_ip: true, + cookie_expires: 0, + storage: 'none' + }, + // This object is used for configuration specific to this plugin + pluginConfig: { + // Puts tracking script in the head instead of the body + head: false, + // Setting this parameter is also optional + respectDNT: true, + // Avoids sending pageview hits from custom paths + // exclude: ["/preview/**", "/do-not-track/me/too/"], + }, + }, }, - plugins: [ +]; + +const plugins = [ "gatsby-plugin-react-helmet", { /** @@ -187,43 +205,6 @@ module.exports = { // resolve: `gatsby-plugin-create-client-paths`, // options: { prefixes: [`/auth/*`, `/a/*`, `/members/profile/*`] }, // }, - { - resolve: `gatsby-plugin-google-analytics`, - options: { - // The property ID; the tracking code won't be generated without it - trackingId: "UA-139234657-1", - // Defines where to place the tracking script - `true` in the head and `false` in the body - head: true, - // Setting this parameter is optional - anonymize: true, - // Setting this parameter is also optional - respectDNT: true, - }, - }, - { - resolve: "gatsby-plugin-google-gtag", - options: { - // You can add multiple tracking ids and a pageview event will be fired for all of them. - trackingIds: [ - "UA-139234657-1", // Google Analytics / GA, - ], - // This object gets passed directly to the gtag config command - // This config will be shared across all trackingIds - gtagConfig: { - anonymize_ip: true, - cookie_expires: 0, - }, - // This object is used for configuration specific to this plugin - pluginConfig: { - // Puts tracking script in the head instead of the body - head: false, - // Setting this parameter is also optional - respectDNT: true, - // Avoids sending pageview hits from custom paths - // exclude: ["/preview/**", "/do-not-track/me/too/"], - }, - }, - }, { resolve: "gatsby-plugin-google-tagmanager", options: { @@ -255,6 +236,10 @@ module.exports = { // Defaults to https://www.googletagmanager.com // selfHostedOrigin: "YOUR_SELF_HOSTED_ORIGIN", + + // defer script tags loading to after consent is given + // managed by Klaro cookie manager + deferLoading: true }, }, { @@ -313,6 +298,7 @@ module.exports = { includeInDevelopment: true } }, + ...googleTagManagerPlugin, { resolve: 'gatsby-plugin-turnstile', options: { @@ -320,5 +306,17 @@ module.exports = { }, }, "gatsby-plugin-netlify", // make sure to keep it last in the array - ], +]; + +module.exports = { + flags: { + FAST_DEV: true, + DEV_SSR: false + }, + siteMetadata: { + title: "OpenInfra Foundation", + description: "The Home of Open Infrastructure", + url: "https://openinfra.dev/" + }, + plugins, } diff --git a/package.json b/package.json index bee69ee13..4597c82e3 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,6 @@ "gatsby": "4.24.0", "gatsby-plugin-anchor-links": "^1.2.1", "gatsby-plugin-feed": "^4.24.0", - "gatsby-plugin-google-analytics": "^4.24.0", - "gatsby-plugin-google-gtag": "^4.24.0", - "gatsby-plugin-google-tagmanager": "^4.24.0", "gatsby-plugin-image": "^2.10.1", "gatsby-plugin-linkedin-insight": "^1.0.1", "gatsby-plugin-manifest": "^4.24.0", @@ -57,6 +54,7 @@ "immutability-helper": "2.9.1", "immutable": "^3.7.6", "jsdom": "^16.2.2", + "klaro": "^0.7.21", "lodash": "^4.17.19", "markdown-it": "^12.0.4", "moment": "^2.27.0", diff --git a/src/utils/EventEmitter.js b/src/utils/EventEmitter.js new file mode 100644 index 000000000..9f7b03145 --- /dev/null +++ b/src/utils/EventEmitter.js @@ -0,0 +1,26 @@ +class EventEmitter extends EventTarget { + static instance; + + constructor() { + if (EventEmitter.instance) { + return EventEmitter.instance; + } + super(); + EventEmitter.instance = this; + } + + emit(eventName, detail = {}) { + const event = new CustomEvent(eventName, { detail }); + this.dispatchEvent(event); + } + + on(eventName, callback, options) { + this.addEventListener(eventName, callback, options); + } + + off(eventName, callback, options) { + this.removeEventListener(eventName, callback, options); + } +} + +export default EventEmitter; diff --git a/src/utils/cookies/CookieManager.js b/src/utils/cookies/CookieManager.js new file mode 100644 index 000000000..fa3620e83 --- /dev/null +++ b/src/utils/cookies/CookieManager.js @@ -0,0 +1,27 @@ +import CookieManagerProvider from "./CookieManagerProvider"; + +class CookieManager { + static instance; + + constructor(provider, services) { + if (CookieManager.instance) { + return CookieManager.instance; + } + + if (!(provider instanceof CookieManagerProvider)) { + throw new Error("Provider must implement CookieManagerProvider interface"); + } + + this.provider = provider; + this.services = services; + this.provider.init(this.services); + + CookieManager.instance = this; + } + + getConsents = () => this.provider.getConsents(); + + show = () => this.provider.show(); +} + +export default CookieManager; diff --git a/src/utils/cookies/CookieManagerProvider.js b/src/utils/cookies/CookieManagerProvider.js new file mode 100644 index 000000000..6a835dcb1 --- /dev/null +++ b/src/utils/cookies/CookieManagerProvider.js @@ -0,0 +1,15 @@ +class CookieManagerProvider { + init = (services) => { + throw new Error("Method 'init()' must be implemented."); + }; + + getConsents = () => { + throw new Error("Method 'getConsents()' must be implemented."); + }; + + show = () => { + throw new Error("Method 'show()' must be implemented."); + }; +} + +export default CookieManagerProvider; diff --git a/src/utils/cookies/providers/KlaroProvider.js b/src/utils/cookies/providers/KlaroProvider.js new file mode 100644 index 000000000..15ad9eb0c --- /dev/null +++ b/src/utils/cookies/providers/KlaroProvider.js @@ -0,0 +1,81 @@ +import * as klaro from "klaro"; +import CookieManagerProvider from "../CookieManagerProvider"; +import { triggerTagManagerTrackEvent } from "../../eventTriggers"; + +class KlaroProvider extends CookieManagerProvider { + init = (services) => { + /** + * For api methods + * @see https://github.com/klaro-org/klaro-js/blob/master/src/lib.js + **/ + this.api = klaro; + this.config = this.#formatConfig(services); + this.consentManager = this.api.getManager(this.config); + }; + + getConsents = () => this.consentManager ? this.consentManager.consents : {}; + + show = () => this.api.render(this.config); + + /** + * @see https://klaro.org/docs/integration/annotated-configuration + **/ + #formatConfig = (services) => ({ + acceptAll: true, + hideLearnMore: true, + translations: { + en: { + purposes: { + analytics: "Analytics", + marketing: "Marketing", + styling: "Styling" + }, + consentNotice: { + description: + "Hi! Could we please enable cookies for anonymous {purposes} to improve your user experience?" + }, + } + }, + services: services.map(service => ({ + name: service.name, + title: service.title, + description: service.description, + purposes: service.purposes, + required: service.required, + cookies: service.cookies, + onAccept: this.#handleAccept.bind(this, service), + onDecline: this.#handleDecline.bind(this, service), + onInit: service.onInit + })) + }); + + #handleAccept = (service) => { + if (service.name === "google-tag-manager") { + const consents = this.getConsents(); + for (let k of Object.keys(consents)) { + if (consents[k]) { + let eventName = "klaro-" + k + "-accepted"; + triggerTagManagerTrackEvent(eventName); + } + } + } else { + let eventName = "klaro-" + service.name + "-accepted"; + triggerTagManagerTrackEvent(eventName); + } + + if (service.onAccept) { + service.onAccept(); + } + }; + + #handleDecline = (service) => { + const eventName = "klaro-" + service.name + "-declined"; + triggerTagManagerTrackEvent(eventName); + + if (service.onDecline) { + service.onDecline(); + } + }; +} + +export default KlaroProvider; diff --git a/src/utils/cookies/services.js b/src/utils/cookies/services.js new file mode 100644 index 000000000..2fe28e9b7 --- /dev/null +++ b/src/utils/cookies/services.js @@ -0,0 +1,30 @@ +import { triggerTagManagerConsentEvent } from "../eventTriggers"; + +const services = [ + { + name: "google-tag-manager", + title: "Google Tag Manager", + purposes: ["marketing"], + default: true, + onInit: () => { + triggerTagManagerConsentEvent("default", { + "analytics_storage": "denied", + }); + } + }, + { + name: "google-analytics", + title: "Google Analytics", + purposes: ["analytics"], + cookies: [/^_ga(_.*)?/], + default: true, + onAccept: () => { + triggerTagManagerConsentEvent("update", { "analytics_storage": "granted" }); + }, + onDecline: () => { + triggerTagManagerConsentEvent("update", { "analytics_storage": "denied" }); + } + } +]; + +export default services; diff --git a/src/utils/dataNormalization.js b/src/utils/dataNormalization.js new file mode 100644 index 000000000..58265384a --- /dev/null +++ b/src/utils/dataNormalization.js @@ -0,0 +1,36 @@ +import _ from "lodash"; + +const FIRST_NAME_KEY = "first_name"; +const LAST_NAME_KEY = "last_name"; +const EMAIL_KEY = "email"; +const OWNER_FIRST_NAME_KEY = `owner_${FIRST_NAME_KEY}`; +const OWNER_LAST_NAME_KEY = `owner_${LAST_NAME_KEY}`; +const OWNER_EMAIL_KEY = `owner_${EMAIL_KEY}`; +const QR_CODE_KEY = "qr_code"; + +const excludeKeys = [ + FIRST_NAME_KEY, + LAST_NAME_KEY, + EMAIL_KEY, + OWNER_FIRST_NAME_KEY, + OWNER_LAST_NAME_KEY, + OWNER_EMAIL_KEY, + QR_CODE_KEY, +]; + +const deepOmit = (obj, keysToOmit) => { + let keysToOmitIndex = _.keyBy(Array.isArray(keysToOmit) ? keysToOmit : [keysToOmit] ); // create an index object of the keys that should be omitted + + const omitFromObject = (obj) => { // the inner function which will be called recursively + return _.transform(obj, function(result, value, key) { // transform to a new object + if (key in keysToOmitIndex) { // if the key is in the index skip it + return; + } + result[key] = _.isObject(value) ? omitFromObject(value) : value; // if the key is an object run it through the inner function - omitFromObject + }) + } + + return omitFromObject(obj); // return the inner function result +} + +export const normalizeData = (data) => deepOmit(data, excludeKeys); diff --git a/src/utils/envVariables.js b/src/utils/envVariables.js index 45f96d0df..16abe6fac 100644 --- a/src/utils/envVariables.js +++ b/src/utils/envVariables.js @@ -18,6 +18,7 @@ export const FRIENDLY_CAPTCHA_SITE_KEY = 'FRIENDLY_CAPTCHA_SITE_KEY'; export const SPONSORED_PROJECT_ID = 'SPONSORED_PROJECT_ID'; export const MEMBERS_SUBPROJECT_ID = 'MEMBERS_SUBPROJECT_ID'; export const TIMEINTERVALSINCE1970_API_URL = 'TIMEINTERVALSINCE1970_API_URL'; +export const GOOGLE_TAGMANAGER_ID = "GOOGLE_TAGMANAGER_ID"; const processEnv = { IDP_BASE_URL: process.env.GATSBY_IDP_BASE_URL, @@ -40,6 +41,7 @@ const processEnv = { SPONSORED_PROJECT_ID: process.env.GATSBY_SPONSORED_PROJECT_ID, MEMBERS_SUBPROJECT_ID: process.env.GATSBY_MEMBERS_SUBPROJECT_ID, TIMEINTERVALSINCE1970_API_URL: process.env.GATSBY_TIMEINTERVALSINCE1970_API_URL, + GOOGLE_TAGMANAGER_ID: process.env.GOOGLE_TAGMANAGER_ID, } export const getEnvVariable = (name) => { @@ -70,6 +72,7 @@ if (typeof window === 'object') { window.SPONSORED_PROJECT_ID = processEnv[SPONSORED_PROJECT_ID]; window.MEMBERS_SUBPROJECT_ID = processEnv[MEMBERS_SUBPROJECT_ID]; window.TIMEINTERVALSINCE1970_API_URL = processEnv[TIMEINTERVALSINCE1970_API_URL]; + window.GOOGLE_TAGMANAGER_ID = processEnv[GOOGLE_TAGMANAGER_ID]; } diff --git a/src/utils/eventTriggers.js b/src/utils/eventTriggers.js new file mode 100644 index 000000000..d675468c6 --- /dev/null +++ b/src/utils/eventTriggers.js @@ -0,0 +1,19 @@ +import EventEmitter from "./EventEmitter"; + +export const INIT_LOGOUT_EVENT = "site_logout"; +export const TAG_MANAGER_TRACK_EVENT = "tag_manager_track_event"; +export const TAG_MANAGER_CONSENT_EVENT = "tag_manager_consent_event"; + +const eventEmitter = new EventEmitter(); + +export const triggerLogoutEvent = () => { + eventEmitter.emit(INIT_LOGOUT_EVENT); +}; + +export const triggerTagManagerTrackEvent = (eventName, eventParams) => { + eventEmitter.emit(TAG_MANAGER_TRACK_EVENT, { eventName, eventParams }); +}; + +export const triggerTagManagerConsentEvent = (consentArg, consentParams) => { + eventEmitter.emit(TAG_MANAGER_CONSENT_EVENT, { consentArg, consentParams }); +}; diff --git a/src/utils/hooks/index.js b/src/utils/hooks/index.js new file mode 100644 index 000000000..1a5acf788 --- /dev/null +++ b/src/utils/hooks/index.js @@ -0,0 +1,6 @@ + +import useEventListener from "./useEventListener"; + +export { + useEventListener, +} diff --git a/src/utils/hooks/useEventListener.js b/src/utils/hooks/useEventListener.js new file mode 100644 index 000000000..e590655ef --- /dev/null +++ b/src/utils/hooks/useEventListener.js @@ -0,0 +1,15 @@ +import { useEffect } from "react"; +import EventEmitter from "../EventEmitter"; + +const eventEmitter = new EventEmitter(); + +const useEventListener = (eventName, callback, options) => { + useEffect(() => { + eventEmitter.on(eventName, callback, options); + return () => { + eventEmitter.off(eventName, callback, options); + }; + }, [eventName, callback, options]); +}; + +export default useEventListener; diff --git a/src/utils/tag-manager/TagManager.js b/src/utils/tag-manager/TagManager.js new file mode 100644 index 000000000..f4eff7cd3 --- /dev/null +++ b/src/utils/tag-manager/TagManager.js @@ -0,0 +1,41 @@ +import TagManagerProvider from "./TagManagerProvider"; +import EventEmitter from "../EventEmitter"; +import { TAG_MANAGER_TRACK_EVENT, TAG_MANAGER_CONSENT_EVENT } from "../eventTriggers"; +import { normalizeData } from "../dataNormalization"; + +const eventEmitter = new EventEmitter(); + +class TagManager { + constructor() { + this.providers = []; + eventEmitter.on(TAG_MANAGER_TRACK_EVENT, this.handleTrackEvent.bind(this)); + eventEmitter.on(TAG_MANAGER_CONSENT_EVENT, this.handleConsentEvent.bind(this)); + } + + addProvider(provider) { + if (!(provider instanceof TagManagerProvider)) { + throw new Error("An instance of TagManagerProvider is required."); + } + this.providers.push(provider); + } + + trackEvent = (eventName, eventParams) => { + this.providers.forEach(provider => provider.trackEvent(eventName, normalizeData(eventParams))); + } + + handleTrackEvent = (event) => { + const { eventName, eventParams } = event.detail; + this.trackEvent(eventName, eventParams); + } + + consent = (consentArg, consentParams) => { + this.providers.forEach(provider => provider.consent && provider.consent(consentArg, consentParams)); + } + + handleConsentEvent = (event) => { + const { consentArg, consentParams } = event.detail; + this.consent(consentArg, consentParams); + } +} + +export default TagManager; diff --git a/src/utils/tag-manager/TagManagerProvider.js b/src/utils/tag-manager/TagManagerProvider.js new file mode 100644 index 000000000..db5ecf663 --- /dev/null +++ b/src/utils/tag-manager/TagManagerProvider.js @@ -0,0 +1,7 @@ +class TagManagerProvider { + trackEvent = (eventName, eventParams) => { + throw new Error("trackEvent method must be implemented"); + } +} + +export default TagManagerProvider; diff --git a/src/utils/tag-manager/providers/GoogleTagManagerProvider.js b/src/utils/tag-manager/providers/GoogleTagManagerProvider.js new file mode 100644 index 000000000..a65eaf5ca --- /dev/null +++ b/src/utils/tag-manager/providers/GoogleTagManagerProvider.js @@ -0,0 +1,49 @@ +import TagManagerProvider from "../TagManagerProvider"; +import { getEnvVariable, GOOGLE_TAGMANAGER_ID } from "@utils/envVariables"; + +class GoogleTagManagerProvider extends TagManagerProvider { + static instance; + + constructor() { + if (GoogleTagManagerProvider.instance) { + return GoogleTagManagerProvider.instance; + } + super(); + if (!getEnvVariable(GOOGLE_TAGMANAGER_ID)) { + console.warn("GoogleTagManagerProvider: GOOGLE_TAGMANAGER_ID environment variable is not set. Tracking will be disabled."); + } + if (typeof window !== "undefined") { + window.dataLayer = window.dataLayer || []; + this.dataLayer = window.dataLayer; + } else { + this.dataLayer = []; + } + GoogleTagManagerProvider.instance = this; + } + + #gtag() { + this.dataLayer.push(arguments); + }; + + trackEvent = (eventName, eventParams) => { + this.#gtag("event", eventName, eventParams); + }; + + config = (targetId, additionalConfig) => { + this.#gtag("config", targetId, additionalConfig); + }; + + set = (parameters) => { + this.#gtag("set", parameters); + }; + + get = (target, fieldName, callback) => { + this.#gtag("get", target, fieldName, callback); + }; + + consent = (consentArg, consentParams) => { + this.#gtag("consent", consentArg, consentParams); + }; +} + +export default GoogleTagManagerProvider; diff --git a/yarn.lock b/yarn.lock index b401d6a75..ccdcd987e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -101,6 +101,15 @@ eslint-visitor-keys "^2.1.0" semver "^6.3.0" +"@babel/eslint-parser@^7.23.10": + version "7.28.0" + resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.28.0.tgz#c1b3fbba070f5bac32e3d02f244201add4afdd6e" + integrity sha512-N4ntErOlKvcbTt01rr5wj3y55xnIdx1ymrfIr8C2WnM1Y9glFgWaGDEULJIazOX3XM9NRzhfJ6zZnQ1sBNWU+w== + dependencies: + "@nicolo-ribaudo/eslint-scope-5-internals" "5.1.1-v1" + eslint-visitor-keys "^2.1.0" + semver "^6.3.1" + "@babel/generator@^7.14.0": version "7.14.1" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.14.1.tgz#1f99331babd65700183628da186f36f63d615c93" @@ -3013,6 +3022,71 @@ "@parcel/source-map" "^2.0.0" chalk "^4.1.0" +"@parcel/watcher-android-arm64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz#507f836d7e2042f798c7d07ad19c3546f9848ac1" + integrity sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA== + +"@parcel/watcher-darwin-arm64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz#3d26dce38de6590ef79c47ec2c55793c06ad4f67" + integrity sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw== + +"@parcel/watcher-darwin-x64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz#99f3af3869069ccf774e4ddfccf7e64fd2311ef8" + integrity sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg== + +"@parcel/watcher-freebsd-x64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz#14d6857741a9f51dfe51d5b08b7c8afdbc73ad9b" + integrity sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ== + +"@parcel/watcher-linux-arm-glibc@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz#43c3246d6892381db473bb4f663229ad20b609a1" + integrity sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA== + +"@parcel/watcher-linux-arm-musl@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz#663750f7090bb6278d2210de643eb8a3f780d08e" + integrity sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q== + +"@parcel/watcher-linux-arm64-glibc@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz#ba60e1f56977f7e47cd7e31ad65d15fdcbd07e30" + integrity sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w== + +"@parcel/watcher-linux-arm64-musl@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz#f7fbcdff2f04c526f96eac01f97419a6a99855d2" + integrity sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg== + +"@parcel/watcher-linux-x64-glibc@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz#4d2ea0f633eb1917d83d483392ce6181b6a92e4e" + integrity sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A== + +"@parcel/watcher-linux-x64-musl@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz#277b346b05db54f55657301dd77bdf99d63606ee" + integrity sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg== + +"@parcel/watcher-win32-arm64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz#7e9e02a26784d47503de1d10e8eab6cceb524243" + integrity sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw== + +"@parcel/watcher-win32-ia32@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz#2d0f94fa59a873cdc584bf7f6b1dc628ddf976e6" + integrity sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ== + +"@parcel/watcher-win32-x64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz#ae52693259664ba6f2228fa61d7ee44b64ea0947" + integrity sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA== + "@parcel/watcher@^2.0.0": version "2.0.5" resolved "https://registry.yarnpkg.com/@parcel/watcher/-/watcher-2.0.5.tgz#f913a54e1601b0aac972803829b0eece48de215b" @@ -3021,6 +3095,30 @@ node-addon-api "^3.2.1" node-gyp-build "^4.3.0" +"@parcel/watcher@^2.4.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher/-/watcher-2.5.1.tgz#342507a9cfaaf172479a882309def1e991fb1200" + integrity sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg== + dependencies: + detect-libc "^1.0.3" + is-glob "^4.0.3" + micromatch "^4.0.5" + node-addon-api "^7.0.0" + optionalDependencies: + "@parcel/watcher-android-arm64" "2.5.1" + "@parcel/watcher-darwin-arm64" "2.5.1" + "@parcel/watcher-darwin-x64" "2.5.1" + "@parcel/watcher-freebsd-x64" "2.5.1" + "@parcel/watcher-linux-arm-glibc" "2.5.1" + "@parcel/watcher-linux-arm-musl" "2.5.1" + "@parcel/watcher-linux-arm64-glibc" "2.5.1" + "@parcel/watcher-linux-arm64-musl" "2.5.1" + "@parcel/watcher-linux-x64-glibc" "2.5.1" + "@parcel/watcher-linux-x64-musl" "2.5.1" + "@parcel/watcher-win32-arm64" "2.5.1" + "@parcel/watcher-win32-ia32" "2.5.1" + "@parcel/watcher-win32-x64" "2.5.1" + "@parcel/workers@2.6.2": version "2.6.2" resolved "https://registry.yarnpkg.com/@parcel/workers/-/workers-2.6.2.tgz#2cae07db7a752295f11c2952b5026e426e38b19b" @@ -6076,6 +6174,13 @@ chokidar@^3.4.2: optionalDependencies: fsevents "~2.1.2" +chokidar@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-4.0.3.tgz#7be37a4c03c9aee1ecfe862a4a23b2c70c205d30" + integrity sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA== + dependencies: + readdirp "^4.0.1" + chownr@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -9407,6 +9512,11 @@ flat-cache@^3.0.4: flatted "^3.1.0" rimraf "^3.0.2" +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + flatted@^3.1.0: version "3.2.7" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" @@ -9828,31 +9938,6 @@ gatsby-plugin-feed@^4.24.0: lodash.merge "^4.6.2" rss "^1.2.2" -gatsby-plugin-google-analytics@^4.24.0: - version "4.24.0" - resolved "https://registry.yarnpkg.com/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-4.24.0.tgz#63ca32c5565e22b7497d361df004e8dc048c4eca" - integrity sha512-opSdLiJ7xAObfl2j9QsNtXiGEKGVb0MLbEqFUs694vAj8T15/wL1/bFcwzX2nZnZoP2YhvVfblYd+AbJ2AVVCQ== - dependencies: - "@babel/runtime" "^7.15.4" - minimatch "3.0.4" - web-vitals "^1.1.2" - -gatsby-plugin-google-gtag@^4.24.0: - version "4.24.0" - resolved "https://registry.yarnpkg.com/gatsby-plugin-google-gtag/-/gatsby-plugin-google-gtag-4.24.0.tgz#71ca4d83c91292490e803048d3342f3d60f1aa68" - integrity sha512-2GHzg727Xr+48kxS5+3xSc246gdQLlAk4L0vn5+KauJsP1aCGb2XpumlUQj8H81TA/BnroBc1wlW4N+k7J4I5Q== - dependencies: - "@babel/runtime" "^7.15.4" - minimatch "^3.1.2" - -gatsby-plugin-google-tagmanager@^4.24.0: - version "4.24.0" - resolved "https://registry.yarnpkg.com/gatsby-plugin-google-tagmanager/-/gatsby-plugin-google-tagmanager-4.24.0.tgz#b8bf68987b46bf1b9a78a46749284ef1cb5b7a34" - integrity sha512-S82kPmkGvse3RkD6AivbNV8qhSapXEHXMjv0Yh2LomrO2w1EIzLjLkhmQV/Dkv1nioRn3TdigMGA1LVYH8fdzQ== - dependencies: - "@babel/runtime" "^7.15.4" - web-vitals "^1.1.2" - gatsby-plugin-image@^2.10.1: version "2.24.0" resolved "https://registry.yarnpkg.com/gatsby-plugin-image/-/gatsby-plugin-image-2.24.0.tgz#965b6c82359f3f51bd8dbf976648f6a81a2c3d03" @@ -11715,6 +11800,11 @@ immutable@^4.0.0-rc.12: resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0-rc.12.tgz#ca59a7e4c19ae8d9bf74a97bdf0f6e2f2a5d0217" integrity sha512-0M2XxkZLx/mi3t8NVwIm1g8nHoEmM9p9UBl/G9k4+hm0kBgOVdMV/B3CY5dQ8qG8qc80NN4gDV4HQv6FTJ5q7A== +immutable@^5.0.2: + version "5.1.3" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-5.1.3.tgz#e6486694c8b76c37c063cca92399fa64098634d4" + integrity sha512-+chQdDfvscSF1SJqv2gn4SRO2ZyS3xL3r7IW/wWEEzrzLisnOlKiQu5ytC/BVNcS15C39WT2Hg/bjKjDMcu+zg== + immutable@~3.7.4, immutable@~3.7.6: version "3.7.6" resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" @@ -13026,6 +13116,15 @@ kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +klaro@^0.7.21: + version "0.7.21" + resolved "https://registry.yarnpkg.com/klaro/-/klaro-0.7.21.tgz#2ecaccb058ef7660fe21563b80a0c367d80b9c8a" + integrity sha512-PbF23xYGPObhg2GL0yqskPqRTziv3RTwVi9QZiBEB/BVulS/e1fFprgRiW6f4utPjb61q/16fWgPwHuuXJZYRA== + dependencies: + "@babel/eslint-parser" "^7.23.10" + sass "^1.25.0" + webpack-merge "^5.10.0" + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -15268,6 +15367,11 @@ node-addon-api@^5.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.0.0.tgz#7d7e6f9ef89043befdb20c1989c905ebde18c501" integrity sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA== +node-addon-api@^7.0.0: + version "7.1.1" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-7.1.1.tgz#1aba6693b0f255258a049d621329329322aad558" + integrity sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ== + node-domexception@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" @@ -18186,6 +18290,11 @@ readdirp@^3.4.0, readdirp@~3.6.0: dependencies: picomatch "^2.2.1" +readdirp@^4.0.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-4.1.2.tgz#eb85801435fbf2a7ee58f19e0921b068fc69948d" + integrity sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg== + readdirp@~3.5.0: version "3.5.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" @@ -19013,6 +19122,17 @@ sass-loader@^10.1.1: schema-utils "^3.0.0" semver "^7.3.2" +sass@^1.25.0: + version "1.90.0" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.90.0.tgz#d6fc2be49c7c086ce86ea0b231a35bf9e33cb84b" + integrity sha512-9GUyuksjw70uNpb1MTYWsH9MQHOHY6kwfnkafC24+7aOMZn9+rVMBxRbLvw756mrBFbIsFg6Xw9IkR2Fnn3k+Q== + dependencies: + chokidar "^4.0.0" + immutable "^5.0.2" + source-map-js ">=0.6.2 <2.0.0" + optionalDependencies: + "@parcel/watcher" "^2.4.1" + sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" @@ -19154,6 +19274,11 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + semver@^7.0.0, semver@^7.3.5: version "7.3.7" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f" @@ -19661,6 +19786,11 @@ source-list-map@^2.0.0: resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== +"source-map-js@>=0.6.2 <2.0.0": + version "1.2.1" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" + integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== + source-map-js@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" @@ -21912,11 +22042,6 @@ web-streams-polyfill@^3.0.3: resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== -web-vitals@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-1.1.2.tgz#06535308168986096239aa84716e68b4c6ae6d1c" - integrity sha512-PFMKIY+bRSXlMxVAQ+m2aw9c/ioUYfDgrYot0YUa+/xa0sakubWhSDyxAKwzymvXVdF4CZI71g06W+mqhzu6ig== - webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" @@ -21957,6 +22082,15 @@ webpack-dev-middleware@^4.3.0: range-parser "^1.2.1" schema-utils "^3.0.0" +webpack-merge@^5.10.0: + version "5.10.0" + resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.10.0.tgz#a3ad5d773241e9c682803abf628d4cd62b8a4177" + integrity sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA== + dependencies: + clone-deep "^4.0.1" + flat "^5.0.2" + wildcard "^2.0.0" + webpack-merge@^5.8.0: version "5.8.0" resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.8.0.tgz#2b39dbf22af87776ad744c390223731d30a68f61" From c17bcce400dd54e720f283e3c0e3280f60d17556 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 21 Aug 2025 13:46:00 -0300 Subject: [PATCH 2/9] Move google tag and google tag manager config to a separated variable --- gatsby-config.js | 444 +++++++++++++++++++++++------------------------ 1 file changed, 217 insertions(+), 227 deletions(-) diff --git a/gatsby-config.js b/gatsby-config.js index 3e4dc91ba..4cd380da2 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -24,42 +24,79 @@ const googleTagManagerPlugin = [ }, }, }, + { + resolve: "gatsby-plugin-google-tagmanager", + options: { + id: "GTM-5SLZBPV", + // Include GTM in development. + // + // Defaults to false meaning GTM will only be loaded in production. + includeInDevelopment: true, + + // datalayer to be set before GTM is loaded + // should be an object or a function that is executed in the browser + // + // Defaults to null + defaultDataLayer: { platform: "gatsby" }, + + // Specify optional GTM environment details. + // gtmAuth: "YOUR_GOOGLE_TAGMANAGER_ENVIRONMENT_AUTH_STRING", + // gtmPreview: "YOUR_GOOGLE_TAGMANAGER_ENVIRONMENT_PREVIEW_NAME", + // dataLayerName: "YOUR_DATA_LAYER_NAME", + + // Name of the event that is triggered + // on every Gatsby route change. + // + // Defaults to gatsby-route-change + // routeChangeEventName: "YOUR_ROUTE_CHANGE_EVENT_NAME", + + // Defaults to false + enableWebVitalsTracking: true, + + // Defaults to https://www.googletagmanager.com + // selfHostedOrigin: "YOUR_SELF_HOSTED_ORIGIN", + + // defer script tags loading to after consent is given + // managed by Klaro cookie manager + deferLoading: true + }, + }, ]; const plugins = [ - "gatsby-plugin-react-helmet", - { - /** - * Gatsby v4 uses ES Modules for importing cssModules by default. - * Disabling this to avoid needing to update in all files and for compatibility - * with other plugins/packages that have not yet been updated. - * @see https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v2-to-v3/#css-modules-are-imported-as-es-modules - * - * Also, since libSass was deprecated in October 2020, the Node Sass package has also been deprecated. - * As such, we have migrated from Node Sass to Dart Sass in package.json. - * @see https://www.gatsbyjs.com/plugins/gatsby-plugin-sass/#v300 - * @see https://sass-lang.com/blog/libsass-is-deprecated#how-do-i-migrate - */ - resolve: "gatsby-plugin-sass", - options: { - cssLoaderOptions: { - esModule: false, - modules: { - namedExport: false, - }, + "gatsby-plugin-react-helmet", + { + /** + * Gatsby v4 uses ES Modules for importing cssModules by default. + * Disabling this to avoid needing to update in all files and for compatibility + * with other plugins/packages that have not yet been updated. + * @see https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v2-to-v3/#css-modules-are-imported-as-es-modules + * + * Also, since libSass was deprecated in October 2020, the Node Sass package has also been deprecated. + * As such, we have migrated from Node Sass to Dart Sass in package.json. + * @see https://www.gatsbyjs.com/plugins/gatsby-plugin-sass/#v300 + * @see https://sass-lang.com/blog/libsass-is-deprecated#how-do-i-migrate + */ + resolve: "gatsby-plugin-sass", + options: { + cssLoaderOptions: { + esModule: false, + modules: { + namedExport: false, }, }, }, - { - resolve: "gatsby-plugin-anchor-links", - options: { - offset: 50 - } - }, - { - resolve: "gatsby-plugin-feed", - options: { - query: ` + }, + { + resolve: "gatsby-plugin-anchor-links", + options: { + offset: 50 + } + }, + { + resolve: "gatsby-plugin-feed", + options: { + query: ` { site { siteMetadata { @@ -69,20 +106,20 @@ const plugins = [ } } `, - feeds: [ - { - serialize: ({ query: { site, allMarkdownRemark } }) => { - return allMarkdownRemark.edges.map(edge => { - return Object.assign({}, edge.node.frontmatter, { - description: edge.node.frontmatter.seo.description, - date: edge.node.frontmatter.date, - url: edge.node.frontmatter.seo.url, - guid: edge.node.frontmatter.seo.url, - custom_elements: [{ "content:encoded": edge.node.html }], - }) + feeds: [ + { + serialize: ({ query: { site, allMarkdownRemark } }) => { + return allMarkdownRemark.edges.map(edge => { + return Object.assign({}, edge.node.frontmatter, { + description: edge.node.frontmatter.seo.description, + date: edge.node.frontmatter.date, + url: edge.node.frontmatter.seo.url, + guid: edge.node.frontmatter.seo.url, + custom_elements: [{ "content:encoded": edge.node.html }], }) - }, - query: ` + }) + }, + query: ` { allMarkdownRemark( sort: { order: DESC, fields: [frontmatter___date] }, @@ -105,207 +142,160 @@ const plugins = [ } } `, - output: "/rss.xml", - title: "OpenInfra Foundation RSS Feed", - // optional configuration to insert feed reference in pages: - // if `string` is used, it will be used to create RegExp and then test if pathname of - // current page satisfied this regular expression; - // if not provided or `undefined`, all pages will have feed reference inserted - match: "^/blog/", - // optional configuration to specify external rss feed, such as feedburner - // link: "https://feeds.feedburner.com/gatsby/blog", - }, - ], - }, + output: "/rss.xml", + title: "OpenInfra Foundation RSS Feed", + // optional configuration to insert feed reference in pages: + // if `string` is used, it will be used to create RegExp and then test if pathname of + // current page satisfied this regular expression; + // if not provided or `undefined`, all pages will have feed reference inserted + match: "^/blog/", + // optional configuration to specify external rss feed, such as feedburner + // link: "https://feeds.feedburner.com/gatsby/blog", + }, + ], }, - { - // keep as first gatsby-source-filesystem plugin for gatsby image support - resolve: "gatsby-source-filesystem", - options: { - path: `${__dirname}/static/img`, - name: "uploads", - }, + }, + { + // keep as first gatsby-source-filesystem plugin for gatsby image support + resolve: "gatsby-source-filesystem", + options: { + path: `${__dirname}/static/img`, + name: "uploads", }, - { - resolve: "gatsby-source-filesystem", - options: { - path: `${__dirname}/src/pages`, - name: "pages", - }, + }, + { + resolve: "gatsby-source-filesystem", + options: { + path: `${__dirname}/src/pages`, + name: "pages", }, - { - resolve: "gatsby-source-filesystem", - options: { - path: `${__dirname}/src/img`, - name: "images", - }, + }, + { + resolve: "gatsby-source-filesystem", + options: { + path: `${__dirname}/src/img`, + name: "images", }, - { - resolve: "gatsby-source-filesystem", - options: { - path: `${__dirname}/src/content/summits`, - name: "summits", - }, + }, + { + resolve: "gatsby-source-filesystem", + options: { + path: `${__dirname}/src/content/summits`, + name: "summits", }, - "gatsby-transformer-json", - "gatsby-plugin-image", - "gatsby-plugin-sharp", - { - resolve: `gatsby-transformer-sharp`, - options: { - checkSupportedExtensions: false, - }, + }, + "gatsby-transformer-json", + "gatsby-plugin-image", + "gatsby-plugin-sharp", + { + resolve: `gatsby-transformer-sharp`, + options: { + checkSupportedExtensions: false, }, - { - resolve: "gatsby-transformer-remark", - options: { - plugins: [ - { - resolve: "gatsby-remark-relative-images", - options: { - name: "uploads", - }, + }, + { + resolve: "gatsby-transformer-remark", + options: { + plugins: [ + { + resolve: "gatsby-remark-relative-images", + options: { + name: "uploads", }, - { - resolve: "gatsby-remark-images", - options: { - // It's important to specify the maxWidth (in pixels) of - // the content container as this plugin uses this as the - // base for generating different widths of each image. - maxWidth: 2048, - linkImagesToOriginal: false, - }, + }, + { + resolve: "gatsby-remark-images", + options: { + // It's important to specify the maxWidth (in pixels) of + // the content container as this plugin uses this as the + // base for generating different widths of each image. + maxWidth: 2048, + linkImagesToOriginal: false, }, - { - resolve: "gatsby-remark-copy-linked-files", - options: { - destinationDir: "static", - }, + }, + { + resolve: "gatsby-remark-copy-linked-files", + options: { + destinationDir: "static", }, - { - resolve: "gatsby-remark-classes", - options: { - classMap: { - "heading[depth=3]": "fix-h3", - "heading[depth=2]": "fix-h2", + }, + { + resolve: "gatsby-remark-classes", + options: { + classMap: { + "heading[depth=3]": "fix-h3", + "heading[depth=2]": "fix-h2", - } } - }, - ], - }, + } + }, + ], }, - /** - * This plugin has been deprecated. - * Gatsby now natively supports client paths. - * @see https://www.gatsbyjs.com/plugins/gatsby-plugin-create-client-paths/ - * @see https://www.gatsbyjs.com/docs/how-to/routing/client-only-routes-and-user-authentication/#handling-client-only-routes-with-gatsby - */ - // { - // resolve: `gatsby-plugin-create-client-paths`, - // options: { prefixes: [`/auth/*`, `/a/*`, `/members/profile/*`] }, - // }, - { - resolve: "gatsby-plugin-google-tagmanager", - options: { - id: "GTM-5SLZBPV", - // Include GTM in development. - // - // Defaults to false meaning GTM will only be loaded in production. - includeInDevelopment: true, - - // datalayer to be set before GTM is loaded - // should be an object or a function that is executed in the browser - // - // Defaults to null - defaultDataLayer: { platform: "gatsby" }, - - // Specify optional GTM environment details. - // gtmAuth: "YOUR_GOOGLE_TAGMANAGER_ENVIRONMENT_AUTH_STRING", - // gtmPreview: "YOUR_GOOGLE_TAGMANAGER_ENVIRONMENT_PREVIEW_NAME", - // dataLayerName: "YOUR_DATA_LAYER_NAME", - - // Name of the event that is triggered - // on every Gatsby route change. - // - // Defaults to gatsby-route-change - // routeChangeEventName: "YOUR_ROUTE_CHANGE_EVENT_NAME", - - // Defaults to false - enableWebVitalsTracking: true, - - // Defaults to https://www.googletagmanager.com - // selfHostedOrigin: "YOUR_SELF_HOSTED_ORIGIN", - - // defer script tags loading to after consent is given - // managed by Klaro cookie manager - deferLoading: true - }, + }, + { + resolve: `gatsby-plugin-manifest`, + options: { + name: `Open Infrastructure Foundation`, + short_name: `Open Infrastructure Foundation`, + start_url: `/`, + background_color: `#ffffff`, + theme_color: `#f15b3e`, + icon: `src/img/icon.png`, + display: `standalone`, }, - { - resolve: `gatsby-plugin-manifest`, - options: { - name: `Open Infrastructure Foundation`, - short_name: `Open Infrastructure Foundation`, - start_url: `/`, - background_color: `#ffffff`, - theme_color: `#f15b3e`, - icon: `src/img/icon.png`, - display: `standalone`, - }, + }, + "gatsby-plugin-remove-serviceworker", + { + resolve: "gatsby-plugin-netlify-cms", + options: { + modulePath: `${__dirname}/src/cms/cms.js`, + // @see https://github.com/netlify/netlify-cms/issues/1690#issuecomment-465078677 + enableIdentityWidget: false, + /** + * Fixes Module not found: Error: Can't resolve "path" bug. + * Webpack 5 doesn't include browser polyfills for node APIs by default anymore, + * so we need to provide them ourselves. + * @see https://github.com/postcss/postcss/issues/1509#issuecomment-772097567 + * @see https://github.com/gatsbyjs/gatsby/issues/31475 + * @see https://github.com/gatsbyjs/gatsby/issues/31179#issuecomment-844588682 + */ + customizeWebpackConfig: (config) => { + config.resolve = { + ...config.resolve, + fallback: { + ...config.resolve.fallback, + path: require.resolve("path-browserify") + } + }; + } }, - "gatsby-plugin-remove-serviceworker", - { - resolve: "gatsby-plugin-netlify-cms", - options: { - modulePath: `${__dirname}/src/cms/cms.js`, - // @see https://github.com/netlify/netlify-cms/issues/1690#issuecomment-465078677 - enableIdentityWidget: false, - /** - * Fixes Module not found: Error: Can't resolve "path" bug. - * Webpack 5 doesn't include browser polyfills for node APIs by default anymore, - * so we need to provide them ourselves. - * @see https://github.com/postcss/postcss/issues/1509#issuecomment-772097567 - * @see https://github.com/gatsbyjs/gatsby/issues/31475 - * @see https://github.com/gatsbyjs/gatsby/issues/31179#issuecomment-844588682 - */ - customizeWebpackConfig: (config) => { - config.resolve = { - ...config.resolve, - fallback: { - ...config.resolve.fallback, - path: require.resolve("path-browserify") - } - }; - } - }, + }, + { + resolve: "gatsby-plugin-purgecss", // purges all unused/unreferenced css rules + options: { + develop: true, // Activates purging in npm run develop + whitelistPatterns: [/^carousel/, /^projects-s/, /^company-level-/, /^more-recent-single-/, /^fa/, /^logo-/, /^modal/], + purgeOnly: ["/style"], // applies purging only on the bulma css file }, - { - resolve: "gatsby-plugin-purgecss", // purges all unused/unreferenced css rules - options: { - develop: true, // Activates purging in npm run develop - whitelistPatterns: [/^carousel/, /^projects-s/, /^company-level-/, /^more-recent-single-/, /^fa/, /^logo-/, /^modal/], - purgeOnly: ["/style"], // applies purging only on the bulma css file - }, - }, // must be after other CSS plugins - { - resolve: "gatsby-plugin-linkedin-insight", - options: { - partnerId: "2906612", + }, // must be after other CSS plugins + { + resolve: "gatsby-plugin-linkedin-insight", + options: { + partnerId: "2906612", - // Include LinkedIn Insight in development. - // Defaults to false meaning LinkedIn Insight will only be loaded in production. - includeInDevelopment: true - } - }, - ...googleTagManagerPlugin, - { - resolve: 'gatsby-plugin-turnstile', - options: { - siteKey: `${process.env.GATSBY_TURNSTILE_SITE_KEY}`, - }, + // Include LinkedIn Insight in development. + // Defaults to false meaning LinkedIn Insight will only be loaded in production. + includeInDevelopment: true + } + }, + ...googleTagManagerPlugin, + { + resolve: 'gatsby-plugin-turnstile', + options: { + siteKey: `${process.env.GATSBY_TURNSTILE_SITE_KEY}`, }, - "gatsby-plugin-netlify", // make sure to keep it last in the array + }, + "gatsby-plugin-netlify", // make sure to keep it last in the array ]; module.exports = { From 4c58bed8acfafe07c71d276273dd74c8507ba1c3 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 22 Aug 2025 14:33:24 -0300 Subject: [PATCH 3/9] Add Klaro cookie handler --- gatsby-config.js | 25 ------------------- package.json | 2 ++ src/utils/cookies/providers/KlaroProvider.js | 3 ++- src/utils/cookies/services.js | 2 +- .../providers/GoogleTagManagerProvider.js | 8 +++--- yarn-dev.sh | 2 ++ yarn.lock | 22 ++++++++++++++++ 7 files changed, 33 insertions(+), 31 deletions(-) diff --git a/gatsby-config.js b/gatsby-config.js index 4cd380da2..3369bc96f 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,29 +1,4 @@ const googleTagManagerPlugin = [ - { - resolve: "gatsby-plugin-google-gtag", - options: { - // You can add multiple tracking ids and a pageview event will be fired for all of them. - trackingIds: [ - "UA-139234657-1", // Google Analytics / GA, - ], - // This object gets passed directly to the gtag config command - // This config will be shared across all trackingIds - gtagConfig: { - anonymize_ip: true, - cookie_expires: 0, - storage: 'none' - }, - // This object is used for configuration specific to this plugin - pluginConfig: { - // Puts tracking script in the head instead of the body - head: false, - // Setting this parameter is also optional - respectDNT: true, - // Avoids sending pageview hits from custom paths - // exclude: ["/preview/**", "/do-not-track/me/too/"], - }, - }, - }, { resolve: "gatsby-plugin-google-tagmanager", options: { diff --git a/package.json b/package.json index 4597c82e3..5148c4b01 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,8 @@ "gatsby": "4.24.0", "gatsby-plugin-anchor-links": "^1.2.1", "gatsby-plugin-feed": "^4.24.0", + "gatsby-plugin-google-analytics": "^v4.24", + "gatsby-plugin-google-tagmanager": "^v4.24", "gatsby-plugin-image": "^2.10.1", "gatsby-plugin-linkedin-insight": "^1.0.1", "gatsby-plugin-manifest": "^4.24.0", diff --git a/src/utils/cookies/providers/KlaroProvider.js b/src/utils/cookies/providers/KlaroProvider.js index 15ad9eb0c..37bd828ed 100644 --- a/src/utils/cookies/providers/KlaroProvider.js +++ b/src/utils/cookies/providers/KlaroProvider.js @@ -23,6 +23,7 @@ class KlaroProvider extends CookieManagerProvider { #formatConfig = (services) => ({ acceptAll: true, hideLearnMore: true, + localStorage: 'localStorage', translations: { en: { purposes: { @@ -50,7 +51,7 @@ class KlaroProvider extends CookieManagerProvider { }); #handleAccept = (service) => { - if (service.name === "google-tag-manager") { + if (service.name === "google-tag-manager" || service.name === "google-analytics") { const consents = this.getConsents(); for (let k of Object.keys(consents)) { if (consents[k]) { diff --git a/src/utils/cookies/services.js b/src/utils/cookies/services.js index 2fe28e9b7..d206bd3bf 100644 --- a/src/utils/cookies/services.js +++ b/src/utils/cookies/services.js @@ -15,7 +15,7 @@ const services = [ { name: "google-analytics", title: "Google Analytics", - purposes: ["analytics"], + purposes: ["marketing"], cookies: [/^_ga(_.*)?/], default: true, onAccept: () => { diff --git a/src/utils/tag-manager/providers/GoogleTagManagerProvider.js b/src/utils/tag-manager/providers/GoogleTagManagerProvider.js index a65eaf5ca..771efc819 100644 --- a/src/utils/tag-manager/providers/GoogleTagManagerProvider.js +++ b/src/utils/tag-manager/providers/GoogleTagManagerProvider.js @@ -1,5 +1,5 @@ import TagManagerProvider from "../TagManagerProvider"; -import { getEnvVariable, GOOGLE_TAGMANAGER_ID } from "@utils/envVariables"; +// import { getEnvVariable, GOOGLE_TAGMANAGER_ID } from "@utils/envVariables"; class GoogleTagManagerProvider extends TagManagerProvider { static instance; @@ -9,9 +9,9 @@ class GoogleTagManagerProvider extends TagManagerProvider { return GoogleTagManagerProvider.instance; } super(); - if (!getEnvVariable(GOOGLE_TAGMANAGER_ID)) { - console.warn("GoogleTagManagerProvider: GOOGLE_TAGMANAGER_ID environment variable is not set. Tracking will be disabled."); - } + // if (!getEnvVariable(GOOGLE_TAGMANAGER_ID)) { + // console.warn("GoogleTagManagerProvider: GOOGLE_TAGMANAGER_ID environment variable is not set. Tracking will be disabled."); + // } if (typeof window !== "undefined") { window.dataLayer = window.dataLayer || []; this.dataLayer = window.dataLayer; diff --git a/yarn-dev.sh b/yarn-dev.sh index 73e8bdbfa..25cc47df6 100755 --- a/yarn-dev.sh +++ b/yarn-dev.sh @@ -1,5 +1,7 @@ #!/bin/bash +NODE_ENV=development + # Source nvm if it exists if [ -f "$HOME/.nvm/nvm.sh" ]; then source "$HOME/.nvm/nvm.sh" diff --git a/yarn.lock b/yarn.lock index ccdcd987e..92b5339bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9938,6 +9938,23 @@ gatsby-plugin-feed@^4.24.0: lodash.merge "^4.6.2" rss "^1.2.2" +gatsby-plugin-google-analytics@^v4.24: + version "4.25.0" + resolved "https://registry.yarnpkg.com/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-4.25.0.tgz#9235094d56ddf945eda184c77e1dade08ef2c0da" + integrity sha512-fbHrViBAbJ0Ch2gcpuJQlGxWoapaNed42k75eR4gCiZPzaTUvCKagJgLG8ro8ukD1rfD594lgLzdSEaYYcH4WQ== + dependencies: + "@babel/runtime" "^7.15.4" + minimatch "3.0.4" + web-vitals "^1.1.2" + +gatsby-plugin-google-tagmanager@^v4.24: + version "4.25.0" + resolved "https://registry.yarnpkg.com/gatsby-plugin-google-tagmanager/-/gatsby-plugin-google-tagmanager-4.25.0.tgz#bc24b4c34964813374c4f0d5ef77e5d370b3d675" + integrity sha512-9l2AoS2eY7O4hPq+Rp/Q1Gg7KcVb2H3+4a6sE7rF0Vo98LQfdLS8/ED/wSY5fQ5+WVR1h7Sm9OEf3wIjTNGXlA== + dependencies: + "@babel/runtime" "^7.15.4" + web-vitals "^1.1.2" + gatsby-plugin-image@^2.10.1: version "2.24.0" resolved "https://registry.yarnpkg.com/gatsby-plugin-image/-/gatsby-plugin-image-2.24.0.tgz#965b6c82359f3f51bd8dbf976648f6a81a2c3d03" @@ -22042,6 +22059,11 @@ web-streams-polyfill@^3.0.3: resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== +web-vitals@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-1.1.2.tgz#06535308168986096239aa84716e68b4c6ae6d1c" + integrity sha512-PFMKIY+bRSXlMxVAQ+m2aw9c/ioUYfDgrYot0YUa+/xa0sakubWhSDyxAKwzymvXVdF4CZI71g06W+mqhzu6ig== + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" From 50f8f7ce47ce4243ec9d818b4e01112c0c104cae Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 22 Aug 2025 15:13:24 -0300 Subject: [PATCH 4/9] Fix minor linting issues --- src/utils/dataNormalization.js | 2 +- src/utils/hooks/index.js | 2 +- src/utils/tag-manager/providers/GoogleTagManagerProvider.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/dataNormalization.js b/src/utils/dataNormalization.js index 58265384a..aa6881e18 100644 --- a/src/utils/dataNormalization.js +++ b/src/utils/dataNormalization.js @@ -19,7 +19,7 @@ const excludeKeys = [ ]; const deepOmit = (obj, keysToOmit) => { - let keysToOmitIndex = _.keyBy(Array.isArray(keysToOmit) ? keysToOmit : [keysToOmit] ); // create an index object of the keys that should be omitted + let keysToOmitIndex = _.keyBy(Array.isArray(keysToOmit) ? keysToOmit : [keysToOmit] ); // create an index object of the keys that should be omitted const omitFromObject = (obj) => { // the inner function which will be called recursively return _.transform(obj, function(result, value, key) { // transform to a new object diff --git a/src/utils/hooks/index.js b/src/utils/hooks/index.js index 1a5acf788..d8b9a6fde 100644 --- a/src/utils/hooks/index.js +++ b/src/utils/hooks/index.js @@ -2,5 +2,5 @@ import useEventListener from "./useEventListener"; export { - useEventListener, + useEventListener, } diff --git a/src/utils/tag-manager/providers/GoogleTagManagerProvider.js b/src/utils/tag-manager/providers/GoogleTagManagerProvider.js index 771efc819..81f749914 100644 --- a/src/utils/tag-manager/providers/GoogleTagManagerProvider.js +++ b/src/utils/tag-manager/providers/GoogleTagManagerProvider.js @@ -21,8 +21,8 @@ class GoogleTagManagerProvider extends TagManagerProvider { GoogleTagManagerProvider.instance = this; } - #gtag() { - this.dataLayer.push(arguments); + #gtag(...args) { + this.dataLayer.push(args); }; trackEvent = (eventName, eventParams) => { From 90e42739e1ebe4777415bf1ef30ef5fb1c7da99a Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 22 Aug 2025 15:14:18 -0300 Subject: [PATCH 5/9] Include GOOGLE_TAGMANAGER_ID env variable or default if not defined or if it is empty --- gatsby-config.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gatsby-config.js b/gatsby-config.js index 3369bc96f..a97299520 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,8 +1,11 @@ +const dotenv = require("dotenv"); + + const googleTagManagerPlugin = [ { resolve: "gatsby-plugin-google-tagmanager", options: { - id: "GTM-5SLZBPV", + id: process.env.GOOGLE_TAGMANAGER_ID || "GTM-5SLZBPV", // Include GTM in development. // // Defaults to false meaning GTM will only be loaded in production. From 6e56725177f5e03b501e6248ae36cf6fdcc84df2 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 22 Aug 2025 15:27:10 -0300 Subject: [PATCH 6/9] Add minor fixes --- gatsby-config.js | 3 +++ src/utils/cookies/providers/KlaroProvider.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gatsby-config.js b/gatsby-config.js index a97299520..2bd60f459 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,5 +1,8 @@ const dotenv = require("dotenv"); +dotenv.config({ + path: `.env` +}); const googleTagManagerPlugin = [ { diff --git a/src/utils/cookies/providers/KlaroProvider.js b/src/utils/cookies/providers/KlaroProvider.js index 37bd828ed..7d584c4b4 100644 --- a/src/utils/cookies/providers/KlaroProvider.js +++ b/src/utils/cookies/providers/KlaroProvider.js @@ -51,7 +51,7 @@ class KlaroProvider extends CookieManagerProvider { }); #handleAccept = (service) => { - if (service.name === "google-tag-manager" || service.name === "google-analytics") { + if (service.name === "google-tag-manager") { const consents = this.getConsents(); for (let k of Object.keys(consents)) { if (consents[k]) { From 158e247a68724ac70877ad5e4ccdbd7e7bdc3b76 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 2 Sep 2025 13:29:02 -0300 Subject: [PATCH 7/9] Add custom gatsby-plugin-google-tagmanager plugin --- .../gatsby-plugin-google-tagmanager/.babelrc | 9 + .../CHANGELOG.md | 793 ++++++++++++++++++ .../gatsby-plugin-google-tagmanager/LICENSE | 22 + .../gatsby-plugin-google-tagmanager/README.md | 102 +++ .../gatsby-browser.js | 99 +++ .../gatsby-node.js | 53 ++ .../gatsby-ssr.js | 127 +++ .../gatsby-plugin-google-tagmanager/index.js | 1 + .../package.json | 48 ++ 9 files changed, 1254 insertions(+) create mode 100644 plugins/gatsby-plugin-google-tagmanager/.babelrc create mode 100644 plugins/gatsby-plugin-google-tagmanager/CHANGELOG.md create mode 100644 plugins/gatsby-plugin-google-tagmanager/LICENSE create mode 100644 plugins/gatsby-plugin-google-tagmanager/README.md create mode 100644 plugins/gatsby-plugin-google-tagmanager/gatsby-browser.js create mode 100644 plugins/gatsby-plugin-google-tagmanager/gatsby-node.js create mode 100644 plugins/gatsby-plugin-google-tagmanager/gatsby-ssr.js create mode 100644 plugins/gatsby-plugin-google-tagmanager/index.js create mode 100644 plugins/gatsby-plugin-google-tagmanager/package.json diff --git a/plugins/gatsby-plugin-google-tagmanager/.babelrc b/plugins/gatsby-plugin-google-tagmanager/.babelrc new file mode 100644 index 000000000..7094b00b6 --- /dev/null +++ b/plugins/gatsby-plugin-google-tagmanager/.babelrc @@ -0,0 +1,9 @@ +{ + "presets": [["babel-preset-gatsby-package"]], + "overrides": [ + { + "test": ["**/gatsby-browser.js"], + "presets": [["babel-preset-gatsby-package", { "browser": true, "esm": true }]] + } + ] +} diff --git a/plugins/gatsby-plugin-google-tagmanager/CHANGELOG.md b/plugins/gatsby-plugin-google-tagmanager/CHANGELOG.md new file mode 100644 index 000000000..8e0ac18c8 --- /dev/null +++ b/plugins/gatsby-plugin-google-tagmanager/CHANGELOG.md @@ -0,0 +1,793 @@ +# Changelog: `gatsby-plugin-google-tagmanager` + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +### [5.12.3](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.12.3/packages/gatsby-plugin-google-tagmanager) (2023-10-26) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +### [5.12.2](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.12.2/packages/gatsby-plugin-google-tagmanager) (2023-10-20) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +### [5.12.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.12.1/packages/gatsby-plugin-google-tagmanager) (2023-10-09) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.12.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.12.0/packages/gatsby-plugin-google-tagmanager) (2023-08-24) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.12) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.11.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.11.0/packages/gatsby-plugin-google-tagmanager) (2023-06-15) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.11) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.10.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.10.0/packages/gatsby-plugin-google-tagmanager) (2023-05-16) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.10) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.9.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.9.0/packages/gatsby-plugin-google-tagmanager) (2023-04-18) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.9) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.8.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.8.0/packages/gatsby-plugin-google-tagmanager) (2023-03-21) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.8) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.7.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.7.0/packages/gatsby-plugin-google-tagmanager) (2023-02-21) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.7) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.6.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.6.0/packages/gatsby-plugin-google-tagmanager) (2023-02-07) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.6) + +#### Bug Fixes + +- update babel monorepo [#37568](https://github.com/gatsbyjs/gatsby/issues/37568) ([13a0a9e](https://github.com/gatsbyjs/gatsby/commit/13a0a9e83dcb015b65dff6b73cdd5dea09c2988f)) + +## [5.5.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.5.0/packages/gatsby-plugin-google-tagmanager) (2023-01-24) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.5) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.4.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.4.0/packages/gatsby-plugin-google-tagmanager) (2023-01-10) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.4) + +#### Chores + +- update babel monorepo [#37386](https://github.com/gatsbyjs/gatsby/issues/37386) ([b941876](https://github.com/gatsbyjs/gatsby/commit/b94187633d94d0f0071b38ffe93380dd802ec70f)) + +### [5.3.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.3.1/packages/gatsby-plugin-google-tagmanager) (2022-12-14) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.3.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.3.0/packages/gatsby-plugin-google-tagmanager) (2022-12-13) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.3) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.2.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.2.0/packages/gatsby-plugin-google-tagmanager) (2022-11-25) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.2) + +#### Other Changes + +- Update pluginOptionsSchema tests [#27904](https://github.com/gatsbyjs/gatsby/issues/27904) ([2d967cb](https://github.com/gatsbyjs/gatsby/commit/2d967cbf3be81bb036f1f1cbc108a5e36c49785c)) + +## [5.1.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.1.0/packages/gatsby-plugin-google-tagmanager) (2022-11-22) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.1) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [5.0.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@5.0.0/packages/gatsby-plugin-google-tagmanager) (2022-11-08) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.0) + +#### Chores + +- Update peerDeps [#36965](https://github.com/gatsbyjs/gatsby/issues/36965) ([b624442](https://github.com/gatsbyjs/gatsby/commit/b6244424fe8b724cbc23b80b2b4f5424cc2055a4)) +- apply patches for v5 [#36796](https://github.com/gatsbyjs/gatsby/issues/36796) ([25f79b6](https://github.com/gatsbyjs/gatsby/commit/25f79b6c3719fdf09584ade620a05c66ba2a697c)) + +## [4.24.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.24.0/packages/gatsby-plugin-google-tagmanager) (2022-09-27) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.24) + +#### Chores + +- allow react/react-dom@experimental [#36533](https://github.com/gatsbyjs/gatsby/issues/36533) ([7ef4a3f](https://github.com/gatsbyjs/gatsby/commit/7ef4a3fe080d45e9edaff9f1d4deebd12a00ddbd)) + +### [4.23.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.23.1/packages/gatsby-plugin-google-tagmanager) (2022-09-22) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.23.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.23.0/packages/gatsby-plugin-google-tagmanager) (2022-09-13) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.23) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.22.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.22.0/packages/gatsby-plugin-google-tagmanager) (2022-08-30) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.22) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.21.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.21.0/packages/gatsby-plugin-google-tagmanager) (2022-08-16) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.21) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.20.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.20.0/packages/gatsby-plugin-google-tagmanager) (2022-08-02) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.20) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.19.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.19.0/packages/gatsby-plugin-google-tagmanager) (2022-07-19) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.19) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +### [4.18.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.18.1/packages/gatsby-plugin-google-tagmanager) (2022-07-12) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.18.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.18.0/packages/gatsby-plugin-google-tagmanager) (2022-07-05) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.18) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.17.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.17.0/packages/gatsby-plugin-google-tagmanager) (2022-06-21) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.17) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.16.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.16.0/packages/gatsby-plugin-google-tagmanager) (2022-06-07) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.16) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +### [4.15.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.15.1/packages/gatsby-plugin-google-tagmanager) (2022-06-01) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.15.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.15.0/packages/gatsby-plugin-google-tagmanager) (2022-05-24) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.15) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.14.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.14.0/packages/gatsby-plugin-google-tagmanager) (2022-05-10) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.14) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.13.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.13.0/packages/gatsby-plugin-google-tagmanager) (2022-04-26) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.13) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +### [4.12.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.12.1/packages/gatsby-plugin-google-tagmanager) (2022-04-13) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.12.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.12.0/packages/gatsby-plugin-google-tagmanager) (2022-04-12) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.12) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +### [4.11.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.11.1/packages/gatsby-plugin-google-tagmanager) (2022-03-31) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.11.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.11.0/packages/gatsby-plugin-google-tagmanager) (2022-03-29) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.11) + +#### Bug Fixes + +- compatibility with react rc 2 [#35108](https://github.com/gatsbyjs/gatsby/issues/35108) ([0c61265](https://github.com/gatsbyjs/gatsby/commit/0c6126574d203c0e6fef173b76859cdcab2f13aa)) + +### [4.10.2](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.10.2/packages/gatsby-plugin-google-tagmanager) (2022-03-23) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +### [4.10.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.10.1/packages/gatsby-plugin-google-tagmanager) (2022-03-18) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.10.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.10.0/packages/gatsby-plugin-google-tagmanager) (2022-03-16) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.10) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.9.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.9.0/packages/gatsby-plugin-google-tagmanager) (2022-03-01) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.9) + +#### Chores + +- Format changelog files ([088f23b](https://github.com/gatsbyjs/gatsby/commit/088f23b084b67f746a383e06e9216cef83270317)) + +## [4.8.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.8.0/packages/gatsby-plugin-google-tagmanager) (2022-02-22) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.8) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.7.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.7.0/packages/gatsby-plugin-google-tagmanager) (2022-02-08) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.7) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.6.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.6.0/packages/gatsby-plugin-google-tagmanager) (2022-01-25) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.6) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.5.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.5.0/packages/gatsby-plugin-google-tagmanager) (2022-01-11) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.5) + +#### Chores + +- upgrade jest [#33277](https://github.com/gatsbyjs/gatsby/issues/33277) ([34cb202](https://github.com/gatsbyjs/gatsby/commit/34cb202d9c8c202f082edb03c4cc1815eb81abe1)) + +## [4.4.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.4.0/packages/gatsby-plugin-google-tagmanager) (2021-12-14) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.4) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.3.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.3.0/packages/gatsby-plugin-google-tagmanager) (2021-12-01) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.3) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.2.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.2.0/packages/gatsby-plugin-google-tagmanager) (2021-11-16) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.2) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +### [4.1.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.1.1/packages/gatsby-plugin-google-tagmanager) (2021-11-09) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.1.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.1.0/packages/gatsby-plugin-google-tagmanager) (2021-11-02) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.1) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [4.0.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@4.0.0/packages/gatsby-plugin-google-tagmanager) (2021-10-21) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.0) + +#### Chores + +- apply patches for v4 [#33170](https://github.com/gatsbyjs/gatsby/issues/33170) ([f8c5141](https://github.com/gatsbyjs/gatsby/commit/f8c5141bf72108a53338fd01514522ae7a1b37bf)) + +## [3.14.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.14.0/packages/gatsby-plugin-google-tagmanager) (2021-09-18) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.14) + +#### Features + +- add option for selfHostedOrigin [#32733](https://github.com/gatsbyjs/gatsby/issues/32733) ([ed72e68](https://github.com/gatsbyjs/gatsby/commit/ed72e68c42da68eaeb0dd7a5ba5404f2f6133a44)) + +#### Chores + +- update babel monorepo [#32996](https://github.com/gatsbyjs/gatsby/issues/32996) ([048c7a7](https://github.com/gatsbyjs/gatsby/commit/048c7a727bbc6a9ad8e27afba72ee20e946c4aaa)) + +## [3.13.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.13.0/packages/gatsby-plugin-google-tagmanager) (2021-09-01) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.13) + +#### Chores + +- re-generate changelogs [#32886](https://github.com/gatsbyjs/gatsby/issues/32886) ([417df15](https://github.com/gatsbyjs/gatsby/commit/417df15230be368a9db91f2ad1a9bc0442733177)) + +## [3.12.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.12.0/packages/gatsby-plugin-google-tagmanager) (2021-08-18) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.12) + +#### Chores + +- update babel monorepo [#32564](https://github.com/gatsbyjs/gatsby/issues/32564) ([a554998](https://github.com/gatsbyjs/gatsby/commit/a554998b4f6765103b650813cf52dbfcc575fecf)) + +## [3.11.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.11.0/packages/gatsby-plugin-google-tagmanager) (2021-08-04) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.11) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [3.10.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.10.0/packages/gatsby-plugin-google-tagmanager) (2021-07-20) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.10) + +#### Chores + +- update babel monorepo [#32238](https://github.com/gatsbyjs/gatsby/issues/32238) ([466d4c0](https://github.com/gatsbyjs/gatsby/commit/466d4c087bbc96abb942a02c67243bcc9a4f2a0a)) + +## [3.9.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.9.0/packages/gatsby-plugin-google-tagmanager) (2021-07-07) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.9) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [3.8.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.8.0/packages/gatsby-plugin-google-tagmanager) (2021-06-23) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.8) + +#### Features + +- enable core webvitals tracking [#31665](https://github.com/gatsbyjs/gatsby/issues/31665) ([1ecd6e1](https://github.com/gatsbyjs/gatsby/commit/1ecd6e12eeedcabc54f3be00137a5d092978de58)) + +#### Chores + +- bump babel minor [#31857](https://github.com/gatsbyjs/gatsby/issues/31857) ([7d42e8d](https://github.com/gatsbyjs/gatsby/commit/7d42e8d866e46e9c39838d812d080d06433f7060)) + +### [3.7.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.7.1/packages/gatsby-plugin-google-tagmanager) (2021-06-10) + +#### Chores + +- bump babel minor [#31857](https://github.com/gatsbyjs/gatsby/issues/31857) [#31859](https://github.com/gatsbyjs/gatsby/issues/31859) ([8636025](https://github.com/gatsbyjs/gatsby/commit/863602567930a39142ed33d9d1f1813b7dec8686)) + +## [3.7.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.7.0/packages/gatsby-plugin-google-tagmanager) (2021-06-09) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.7) + +#### Chores + +- update babel monorepo [#31143](https://github.com/gatsbyjs/gatsby/issues/31143) ([701ab2f](https://github.com/gatsbyjs/gatsby/commit/701ab2f6690c3f1bbaf60cf572513ea566cc9ec9)) + +## [3.6.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.6.0/packages/gatsby-plugin-google-tagmanager) (2021-05-25) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.6) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [3.5.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.5.0/packages/gatsby-plugin-google-tagmanager) (2021-05-12) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.5) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [3.4.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.4.0/packages/gatsby-plugin-google-tagmanager) (2021-04-28) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.4) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [3.3.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.3.0/packages/gatsby-plugin-google-tagmanager) (2021-04-14) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.3) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [3.2.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.2.0/packages/gatsby-plugin-google-tagmanager) (2021-03-30) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.2) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [3.1.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.1.0/packages/gatsby-plugin-google-tagmanager) (2021-03-16) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.1) + +#### Chores + +- update eslint to fix linting issues fix [#29988](https://github.com/gatsbyjs/gatsby/issues/29988) ([5636389](https://github.com/gatsbyjs/gatsby/commit/5636389e8fa626c644e90abc14589e9961d98c68)) + +## [3.0.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@3.0.0/packages/gatsby-plugin-google-tagmanager) (2021-03-02) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v3.0) + +#### Other Changes + +- Move peerdeps to 16.9.0 & 17+ for react & react-dom [#29735](https://github.com/gatsbyjs/gatsby/issues/29735) ([6b86b99](https://github.com/gatsbyjs/gatsby/commit/6b86b99f7e760c6ffa74b1330399d9fdd94e48a2)) + +## [2.11.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@2.11.0/packages/gatsby-plugin-google-tagmanager) (2021-02-02) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v2.32) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.10.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@2.10.0/packages/gatsby-plugin-google-tagmanager) (2021-01-20) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v2.31) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.9.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@2.9.0/packages/gatsby-plugin-google-tagmanager) (2021-01-06) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v2.30) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.8.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@2.8.0/packages/gatsby-plugin-google-tagmanager) (2020-12-15) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v2.29) + +#### Chores + +- update dependency cross-env to ^7.0.3 [#28505](https://github.com/gatsbyjs/gatsby/issues/28505) ([a819b9b](https://github.com/gatsbyjs/gatsby/commit/a819b9bfb663139f7b06c3ed7d6d6069a2382b2c)) + +## [2.7.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@2.7.0/packages/gatsby-plugin-google-tagmanager) (2020-12-02) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v2.28) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.6.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@2.6.0/packages/gatsby-plugin-google-tagmanager) (2020-11-20) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v2.27) + +#### Chores + +- update babel monorepo [#27528](https://github.com/gatsbyjs/gatsby/issues/27528) ([539dbb0](https://github.com/gatsbyjs/gatsby/commit/539dbb09166e346a6cee568973d2de3d936e8ef3)) + +## [2.5.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-google-tagmanager@2.5.0/packages/gatsby-plugin-google-tagmanager) (2020-11-12) + +[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v2.26) + +#### Bug Fixes + +- allow functions for defaultDataLayer option [#27886](https://github.com/gatsbyjs/gatsby/issues/27886) ([631f3c4](https://github.com/gatsbyjs/gatsby/commit/631f3c401ed7c4d659604d5dd3170521bd477a61)) + + + +# [2.4.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.16...gatsby-plugin-google-tagmanager@2.4.0) (2020-11-02) + +### Features + +- **gatsby:** release plugin option validation ([#27437](https://github.com/gatsbyjs/gatsby/issues/27437)) ([41ae1c0](https://github.com/gatsbyjs/gatsby/commit/41ae1c07ad9919655782ef17feed8cf4f14f12d8)) + +## [2.3.16](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.15...gatsby-plugin-google-tagmanager@2.3.16) (2020-10-14) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.15](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.14...gatsby-plugin-google-tagmanager@2.3.15) (2020-10-06) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.14](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.13...gatsby-plugin-google-tagmanager@2.3.14) (2020-10-01) + +### Bug Fixes + +- **gatsby-plugin-google-tagmanager:** Add "aria-hidden" ([#27062](https://github.com/gatsbyjs/gatsby/issues/27062)) ([0ecba23](https://github.com/gatsbyjs/gatsby/commit/0ecba231f37a76255333cc9846bcd5b392394ce0)) + +## [2.3.13](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.12...gatsby-plugin-google-tagmanager@2.3.13) (2020-09-28) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.12](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.11...gatsby-plugin-google-tagmanager@2.3.12) (2020-09-15) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.11](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.10...gatsby-plugin-google-tagmanager@2.3.11) (2020-07-09) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.10](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.9...gatsby-plugin-google-tagmanager@2.3.10) (2020-07-02) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.9](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.8...gatsby-plugin-google-tagmanager@2.3.9) (2020-07-01) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.8](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.7...gatsby-plugin-google-tagmanager@2.3.8) (2020-07-01) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.7](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.6...gatsby-plugin-google-tagmanager@2.3.7) (2020-06-24) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.6](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.5...gatsby-plugin-google-tagmanager@2.3.6) (2020-06-22) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.5](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.4...gatsby-plugin-google-tagmanager@2.3.5) (2020-06-09) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.4](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.3...gatsby-plugin-google-tagmanager@2.3.4) (2020-06-02) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.2...gatsby-plugin-google-tagmanager@2.3.3) (2020-05-20) + +### Features + +- **tagmanager:** add configurable event names ([#21362](https://github.com/gatsbyjs/gatsby/issues/21362)) ([#24076](https://github.com/gatsbyjs/gatsby/issues/24076)) ([81a3181](https://github.com/gatsbyjs/gatsby/commit/81a3181)) + +## [2.3.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.1...gatsby-plugin-google-tagmanager@2.3.2) (2020-05-20) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.3.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.3.0...gatsby-plugin-google-tagmanager@2.3.1) (2020-05-05) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +# [2.3.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.2.4...gatsby-plugin-google-tagmanager@2.3.0) (2020-04-27) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.2.4](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.2.3...gatsby-plugin-google-tagmanager@2.2.4) (2020-04-24) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.2.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.2.2...gatsby-plugin-google-tagmanager@2.2.3) (2020-04-17) + +### Bug Fixes + +- wrap ignore pattern in quotes ([#23176](https://github.com/gatsbyjs/gatsby/issues/23176)) ([7563db6](https://github.com/gatsbyjs/gatsby/commit/7563db6)) + +## [2.2.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.2.1...gatsby-plugin-google-tagmanager@2.2.2) (2020-04-16) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.2.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.2.0...gatsby-plugin-google-tagmanager@2.2.1) (2020-03-23) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +# [2.2.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.27...gatsby-plugin-google-tagmanager@2.2.0) (2020-03-20) + +### Features + +- **gatsby:** bump node min version to 10.13.0 ([#22400](https://github.com/gatsbyjs/gatsby/issues/22400)) ([83d681a](https://github.com/gatsbyjs/gatsby/commit/83d681a)) + +## [2.1.27](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.26...gatsby-plugin-google-tagmanager@2.1.27) (2020-03-16) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.26](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.25...gatsby-plugin-google-tagmanager@2.1.26) (2020-03-06) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.25](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.24...gatsby-plugin-google-tagmanager@2.1.25) (2020-02-01) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.24](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.23...gatsby-plugin-google-tagmanager@2.1.24) (2020-01-14) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.23](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.22...gatsby-plugin-google-tagmanager@2.1.23) (2020-01-09) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.22](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.20...gatsby-plugin-google-tagmanager@2.1.22) (2020-01-09) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.21](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.20...gatsby-plugin-google-tagmanager@2.1.21) (2020-01-09) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.20](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.18...gatsby-plugin-google-tagmanager@2.1.20) (2019-12-10) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.19](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.18...gatsby-plugin-google-tagmanager@2.1.19) (2019-12-10) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.18](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.17...gatsby-plugin-google-tagmanager@2.1.18) (2019-11-26) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.17](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.16...gatsby-plugin-google-tagmanager@2.1.17) (2019-11-15) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.16](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.15...gatsby-plugin-google-tagmanager@2.1.16) (2019-11-10) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.15](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.14...gatsby-plugin-google-tagmanager@2.1.15) (2019-10-14) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.14](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.13...gatsby-plugin-google-tagmanager@2.1.14) (2019-10-14) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.13](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.12...gatsby-plugin-google-tagmanager@2.1.13) (2019-10-09) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.12](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.10...gatsby-plugin-google-tagmanager@2.1.12) (2019-09-26) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.11](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.10...gatsby-plugin-google-tagmanager@2.1.11) (2019-09-26) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.10](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.9...gatsby-plugin-google-tagmanager@2.1.10) (2019-09-20) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.9](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.8...gatsby-plugin-google-tagmanager@2.1.9) (2019-09-09) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.8](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.7...gatsby-plugin-google-tagmanager@2.1.8) (2019-09-01) + +### Bug Fixes + +- update minor updates in packages except react, babel and eslint ([#17254](https://github.com/gatsbyjs/gatsby/issues/17254)) ([252d867](https://github.com/gatsbyjs/gatsby/commit/252d867)) + +## [2.1.7](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.6...gatsby-plugin-google-tagmanager@2.1.7) (2019-08-23) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.6](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.5...gatsby-plugin-google-tagmanager@2.1.6) (2019-08-20) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.5](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.4...gatsby-plugin-google-tagmanager@2.1.5) (2019-08-02) + +### Bug Fixes + +- **gatsby-plugin-google-tagmanager:** fix custom dataLayer name ([#16304](https://github.com/gatsbyjs/gatsby/issues/16304)) ([6d097a5](https://github.com/gatsbyjs/gatsby/commit/6d097a5)) + +## [2.1.4](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.3...gatsby-plugin-google-tagmanager@2.1.4) (2019-07-12) + +### Bug Fixes + +- correct links in package changelogs ([#15630](https://github.com/gatsbyjs/gatsby/issues/15630)) ([d07b9dd](https://github.com/gatsbyjs/gatsby/commit/d07b9dd)) + +## [2.1.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.2...gatsby-plugin-google-tagmanager@2.1.3) (2019-07-11) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.1.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.1...gatsby-plugin-google-tagmanager@2.1.2) (2019-07-09) + +### Features + +- **gatsby-plugin-google-tagmanager:** defaultDataLayer ([#11379](https://github.com/gatsbyjs/gatsby/issues/11379)) ([3e26eeb](https://github.com/gatsbyjs/gatsby/commit/3e26eeb)) + +## [2.1.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.1.0...gatsby-plugin-google-tagmanager@2.1.1) (2019-07-02) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +# [2.1.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.15...gatsby-plugin-google-tagmanager@2.1.0) (2019-06-20) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.0.15](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.14...gatsby-plugin-google-tagmanager@2.0.15) (2019-05-30) + +### Bug Fixes + +- **gatsby-plugin-google-tagmanager:** guard against dataLayer being undefined in development ([#14437](https://github.com/gatsbyjs/gatsby/issues/14437)) ([ecb5d7b](https://github.com/gatsbyjs/gatsby/commit/ecb5d7b)), closes [#14424](https://github.com/gatsbyjs/gatsby/issues/14424) + +## [2.0.14](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.13...gatsby-plugin-google-tagmanager@2.0.14) (2019-05-29) + +### Bug Fixes + +- **gatsby-plugin-google-tagmanager:** Properly communicate site title with GTM services ([#14384](https://github.com/gatsbyjs/gatsby/issues/14384)) ([f9bb78a](https://github.com/gatsbyjs/gatsby/commit/f9bb78a)) + +### Features + +- **gatsby-plugin-google-tagmanager:** Allow to place the GTM script … ([#13424](https://github.com/gatsbyjs/gatsby/issues/13424)) ([0b56c3b](https://github.com/gatsbyjs/gatsby/commit/0b56c3b)) + +## [2.0.13](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.12...gatsby-plugin-google-tagmanager@2.0.13) (2019-04-11) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.0.12](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.11...gatsby-plugin-google-tagmanager@2.0.12) (2019-03-28) + +### Bug Fixes + +- **gatsby-plugin-google-tagmanager:** update dataLayer to be camelCased ([#12920](https://github.com/gatsbyjs/gatsby/issues/12920)) ([057dc9a](https://github.com/gatsbyjs/gatsby/commit/057dc9a)) + +## [2.0.11](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.10...gatsby-plugin-google-tagmanager@2.0.11) (2019-03-25) + +### Features + +- **gatsby-plugin-google-tagmanager:** Add plugin option for custom dataLayer name ([#12783](https://github.com/gatsbyjs/gatsby/issues/12783)) ([4a149c](https://github.com/gatsbyjs/gatsby/commit/4a149c)) + +## [2.0.10](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.9...gatsby-plugin-google-tagmanager@2.0.10) (2019-03-11) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + +## [2.0.9](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.8...gatsby-plugin-google-tagmanager@2.0.9) (2019-02-01) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + + + +## [2.0.8](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.7...gatsby-plugin-google-tagmanager@2.0.8) (2019-01-24) + +### Bug Fixes + +- **gatsby-plugin-google-tagmanager:** handle line breaks ([#11169](https://github.com/gatsbyjs/gatsby/issues/11169)) ([d974f80](https://github.com/gatsbyjs/gatsby/commit/d974f80)) + + + +## [2.0.7](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.6...gatsby-plugin-google-tagmanager@2.0.7) (2018-11-29) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + + + +## [2.0.6](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.5...gatsby-plugin-google-tagmanager@2.0.6) (2018-10-29) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + + + +## [2.0.5](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.0-rc.1...gatsby-plugin-google-tagmanager@2.0.5) (2018-09-17) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + + + +# [2.0.0-rc.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.0-rc.0...gatsby-plugin-google-tagmanager@2.0.0-rc.1) (2018-08-29) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + + + +# [2.0.0-rc.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.0-beta.3...gatsby-plugin-google-tagmanager@2.0.0-rc.0) (2018-08-21) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + + + +# [2.0.0-beta.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.0-beta.2...gatsby-plugin-google-tagmanager@2.0.0-beta.3) (2018-07-21) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + + + +# [2.0.0-beta.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.0-beta.1...gatsby-plugin-google-tagmanager@2.0.0-beta.2) (2018-06-20) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + + + +# [2.0.0-beta.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@2.0.0-beta.0...gatsby-plugin-google-tagmanager@2.0.0-beta.1) (2018-06-17) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager + + + +# [2.0.0-beta.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-tagmanager@1.0.19...gatsby-plugin-google-tagmanager@2.0.0-beta.0) (2018-06-17) + +**Note:** Version bump only for package gatsby-plugin-google-tagmanager diff --git a/plugins/gatsby-plugin-google-tagmanager/LICENSE b/plugins/gatsby-plugin-google-tagmanager/LICENSE new file mode 100644 index 000000000..720fea247 --- /dev/null +++ b/plugins/gatsby-plugin-google-tagmanager/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Gatsbyjs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/gatsby-plugin-google-tagmanager/README.md b/plugins/gatsby-plugin-google-tagmanager/README.md new file mode 100644 index 000000000..4d727e639 --- /dev/null +++ b/plugins/gatsby-plugin-google-tagmanager/README.md @@ -0,0 +1,102 @@ +# gatsby-plugin-google-tagmanager + +Easily add Google Tagmanager to your Gatsby site. + +## Install + +`npm install gatsby-plugin-google-tagmanager` + +## How to use + +// In your gatsby-config.js +plugins: [ + { + resolve: "gatsby-plugin-google-tagmanager", + options: { + id: "YOUR_GOOGLE_TAGMANAGER_ID", + + // Include GTM in development. + // + // Defaults to false meaning GTM will only be loaded in production. + includeInDevelopment: false, + + // datalayer to be set before GTM is loaded + // should be an object or a function that is executed in the browser + // + // Defaults to null + defaultDataLayer: { platform: "gatsby" }, + + // Specify optional GTM environment details. + gtmAuth: "YOUR_GOOGLE_TAGMANAGER_ENVIRONMENT_AUTH_STRING", + gtmPreview: "YOUR_GOOGLE_TAGMANAGER_ENVIRONMENT_PREVIEW_NAME", + dataLayerName: "YOUR_DATA_LAYER_NAME", + + // Name of the event that is triggered + // on every Gatsby route change. + // + // Defaults to gatsby-route-change + routeChangeEventName: "YOUR_ROUTE_CHANGE_EVENT_NAME", + // Defaults to false + enableWebVitalsTracking: true, + // Defaults to https://www.googletagmanager.com + selfHostedOrigin: "YOUR_SELF_HOSTED_ORIGIN", + // Defaults to gtm.js + selfHostedPath: "YOUR_SELF_HOSTED_PATH", + + // Defer loading of GTM script until consent is given. + deferLoading: true, + }, + }, +] + +If you like to use data at runtime for your defaultDataLayer you can do that by defining it as a function. + +// In your gatsby-config.js +plugins: [ + { + resolve: "gatsby-plugin-google-tagmanager", + options: { + // datalayer to be set before GTM is loaded + // should be a stringified object or object + // + // Defaults to null + defaultDataLayer: function () { + return { + pageType: window.pageType, + } + }, + }, + }, +] + +This plugin only initiates the tag manager _container_. If you want to use Google Analytics, please also add `gatsby-plugin-google-analytics`. + +If you want to link analytics use with anything inside the container (for example, a cookie consent manager such as OneTrust), you will need to ensure that the tag manager script comes _before_ the analytics script in your `gatsby-config.js`. + +#### Tracking routes + +This plugin will fire a new event called `gatsby-route-change` (or as in the `gatsby-config.js` configured `routeChangeEventName`) whenever a route is changed in your Gatsby application. To record this in Google Tag Manager, we will need to add a trigger to the desired tag to listen for the event: + +1. Visit the [Google Tag Manager console](https://tagmanager.google.com/) and click on the workspace for your site. +2. Navigate to the desired tag using the 'Tags' tab of the menu on the right hand side. +3. Under "Triggering", click the pencil icon, then the "+" button to add a new trigger. +4. In the "Choose a trigger" window, click on the "+" button again. +5. Choose the trigger type by clicking the pencil button and clicking "Custom event". For event name, enter `gatsby-route-change` (or as in the `gatsby-config.js` configured `routeChangeEventName`). + +This tag will now catch every route change in Gatsby, and you can add Google tag services as you wish to it. + +#### Tracking Core Web Vitals + +Optimizing for the quality of user experience is key to the long-term success of any site on the web. Capturing Real user metrics (RUM) helps you understand the experience of your user/customer. By setting `enableWebVitalsTracking` to `true`, GTM will get ["core-web-vitals"](https://web.dev/vitals/) events with their values. + +You can save this data in Google Analytics or any database of your choosing. + +We send three metrics: + +- **Largest Contentful Paint (LCP)**: measures loading performance. To provide a good user experience, LCP should occur within 2.5 seconds of when the page first starts loading. +- **First Input Delay (FID)**: measures interactivity. To provide a good user experience, pages should have a FID of 100 milliseconds or less. +- **Cumulative Layout Shift (CLS)**: measures visual stability. To provide a good user experience, pages should maintain a CLS of 0.1. or less. + +#### Note + +Out of the box this plugin will simply load Google Tag Manager on the initial page/app load. It's up to you to fire tags based on changes in your app. See the above "Tracking routes" section for an example. diff --git a/plugins/gatsby-plugin-google-tagmanager/gatsby-browser.js b/plugins/gatsby-plugin-google-tagmanager/gatsby-browser.js new file mode 100644 index 000000000..69ff33923 --- /dev/null +++ b/plugins/gatsby-plugin-google-tagmanager/gatsby-browser.js @@ -0,0 +1,99 @@ +const listOfMetricsSend = new Set(); + +const debounce = (fn, timeout) => { + let timer = null; + + return (...args) => { + if (timer) { + clearTimeout(timer); + } + + timer = setTimeout(fn, timeout, ...args); + }; +}; + +const sendWebVitals = (dataLayerName = "dataLayer") => { + const win = window; + + const sendData = (data) => { + if (listOfMetricsSend.has(data.name)) { + return; + } + listOfMetricsSend.add(data.name); + + sendToGTM(data, win[dataLayerName]); + }; + + return import("web-vitals/base").then(({ getLCP, getFID, getCLS }) => { + const debouncedCLS = debounce(sendData, 3000); + // we don't need to debounce FID - we send it when it happens + const debouncedFID = sendData; + // LCP can occur multiple times so we debounce it + const debouncedLCP = debounce(sendData, 3000); + + // With the true flag, we measure all previous occurrences too, in case we start listening too late. + getCLS(debouncedCLS, true); + getFID(debouncedFID, true); + getLCP(debouncedLCP, true); + }); +}; + +const sendToGTM = ({ name, value, id }, dataLayer) => { + // Log warning and return if dataLayer is undefined + if (!dataLayer) { + console.log("GTM dataLayer is undefined. Consent granted?"); + return; + } + + dataLayer.push({ + event: "core-web-vitals", + webVitalsMeasurement: { + name: name, + // The `id` value will be unique to the current page load. When sending + // multiple values from the same page (e.g. for CLS), Google Analytics can + // compute a total by grouping on this ID (note: requires `eventLabel` to + // be a dimension in your report). + id, + // Google Analytics metrics must be integers, so the value is rounded. + // For CLS the value is first multiplied by 1000 for greater precision + // (note: increase the multiplier for greater precision if needed). + value: Math.round(name === "CLS" ? value * 1000 : value) + } + }); +}; + +export const onRouteUpdate = (_, pluginOptions) => { + if ( + process.env.NODE_ENV === "production" || + pluginOptions.includeInDevelopment + ) { + // wrap inside a timeout to ensure the title has properly been changed + setTimeout(() => { + const data = pluginOptions.dataLayerName + ? window[pluginOptions.dataLayerName] + : window.dataLayer; + + // Log warning and return if dataLayer is undefined + if (!data) { + console.log("GTM dataLayer is undefined. Consent granted?"); + return; + } + + const eventName = pluginOptions.routeChangeEventName + ? pluginOptions.routeChangeEventName + : "gatsby-route-change"; + + data.push({ event: eventName }); + }, 50); + } +}; + +export const onInitialClientRender = (_, pluginOptions) => { + // we only load the polyfill in production so we can't enable it in development + if ( + process.env.NODE_ENV === "production" && + pluginOptions.enableWebVitalsTracking + ) { + sendWebVitals(pluginOptions.dataLayerName); + } +}; diff --git a/plugins/gatsby-plugin-google-tagmanager/gatsby-node.js b/plugins/gatsby-plugin-google-tagmanager/gatsby-node.js new file mode 100644 index 000000000..81953cb2a --- /dev/null +++ b/plugins/gatsby-plugin-google-tagmanager/gatsby-node.js @@ -0,0 +1,53 @@ +/** @type {import('gatsby').GatsbyNode["onPreInit"]} */ +exports.onPreInit = (args, options) => { + if (options.defaultDataLayer) { + options.defaultDataLayer = { + type: typeof options.defaultDataLayer, + value: options.defaultDataLayer + } + + if (options.defaultDataLayer.type === "function") { + options.defaultDataLayer.value = options.defaultDataLayer.value.toString() + } + } +} + +exports.pluginOptionsSchema = ({ Joi }) => + Joi.object({ + id: Joi.string().description( + "Google Tag Manager ID that can be found in your Tag Manager dashboard." + ), + includeInDevelopment: Joi.boolean() + .default(false) + .description( + "Include Google Tag Manager when running in development mode." + ), + defaultDataLayer: Joi.alternatives() + .try(Joi.object(), Joi.function()) + .default(null) + .description( + "Data layer to be set before Google Tag Manager is loaded. Should be an object or a function." + ), + gtmAuth: Joi.string().description( + "Google Tag Manager environment auth string." + ), + gtmPreview: Joi.string().description( + "Google Tag Manager environment preview name." + ), + dataLayerName: Joi.string().description("Data layer name."), + routeChangeEventName: Joi.string() + .default("gatsby-route-change") + .description( + "Name of the event that is triggered on every Gatsby route change." + ), + enableWebVitalsTracking: Joi.boolean().default(false), + selfHostedOrigin: Joi.string() + .default("https://www.googletagmanager.com/") + .description("The origin where GTM is hosted."), + selfHostedPath: Joi.string() + .default("gtm.js") + .description("The path where GTM is hosted."), + deferLoading: Joi.boolean() + .default(false) + .description("Defer loading of Google Tag Manager script until consent is given.") + }) diff --git a/plugins/gatsby-plugin-google-tagmanager/gatsby-ssr.js b/plugins/gatsby-plugin-google-tagmanager/gatsby-ssr.js new file mode 100644 index 000000000..788d25451 --- /dev/null +++ b/plugins/gatsby-plugin-google-tagmanager/gatsby-ssr.js @@ -0,0 +1,127 @@ +import * as React from "react"; +import { oneLine, stripIndent } from "common-tags"; + +const generateGTM = ({ + id, + environmentParamStr, + dataLayerName, + selfHostedOrigin, + selfHostedPath, +}) => stripIndent` + (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= + '${selfHostedOrigin}/${selfHostedPath}?id='+i+dl+'${environmentParamStr}';f.parentNode.insertBefore(j,f); + })(window,document,'script','${dataLayerName}', '${id}');`; + +const generateGTMIframe = ({ id, environmentParamStr, selfHostedOrigin, deferLoading }) => { + const iframeSrc = deferLoading ? `data-src` : `src`; + return oneLine``; +} + +const generateDefaultDataLayer = (dataLayer, reporter, dataLayerName) => { + let result = `window.${dataLayerName} = window.${dataLayerName} || [];` + + if (dataLayer.type === "function") { + result += `window.${dataLayerName}.push((${dataLayer.value})());` + } else { + if (dataLayer.type !== "object" || dataLayer.value.constructor !== Object) { + reporter.panic( + `Oops the plugin option "defaultDataLayer" should be a plain object. "${dataLayer}" is not valid.` + ) + } + + result += `window.${dataLayerName}.push(${JSON.stringify( + dataLayer.value + )});` + } + + return stripIndent`${result}`; +} + +export const onRenderBody = ( + { setHeadComponents, setPreBodyComponents, reporter }, + { + id, + includeInDevelopment = false, + gtmAuth, + gtmPreview, + defaultDataLayer, + dataLayerName = "dataLayer", + enableWebVitalsTracking = false, + selfHostedOrigin = "https://www.googletagmanager.com/", + selfHostedPath = "gtm.js", + deferLoading = false + } +) => { + if (process.env.NODE_ENV === "production" || includeInDevelopment) { + const environmentParamStr = + gtmAuth && gtmPreview + ? oneLine`>m_auth=${gtmAuth}>m_preview=${gtmPreview}>m_cookies_win=x` + : ""; + + let defaultDataLayerCode = ""; + if (defaultDataLayer) { + defaultDataLayerCode = generateDefaultDataLayer( + defaultDataLayer, + reporter, + dataLayerName + ); + } + + selfHostedOrigin = selfHostedOrigin.replace(/\/$/, ""); + + const inlineScripts = []; + if (enableWebVitalsTracking) { + // web-vitals/polyfill (necessary for non chromium browsers) + // @seehttps://www.npmjs.com/package/web-vitals#how-the-polyfill-works + inlineScripts.push( +