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..eec15cb58 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,47 +1,83 @@ -module.exports = { - flags: { - FAST_DEV: true, - DEV_SSR: false - }, - siteMetadata: { - title: "OpenInfra Foundation", - description: "The Home of Open Infrastructure", - url: "https://openinfra.dev/" +const dotenv = require("dotenv"); + +dotenv.config({ + path: `.env` +}); + +const googleTagManagerPlugin = [ + { + resolve: require.resolve("./plugins/gatsby-plugin-google-tagmanager"), + options: { + id: process.env.GOOGLE_TAGMANAGER_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 + }, }, - 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, - }, +]; + +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, }, }, }, - { - 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 { @@ -51,20 +87,20 @@ module.exports = { } } `, - 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] }, @@ -87,238 +123,171 @@ module.exports = { } } `, - 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-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: { - 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", - }, + }, + { + 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 - } - }, - { - 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 = { + 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..41cfae39f 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,6 @@ "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 +55,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/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( +