diff --git a/gatsby-config.js b/gatsby-config.js index 8cc1435..79df68b 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -16,22 +16,26 @@ module.exports = { plugins: [ 'gatsby-plugin-sass', { - resolve: 'gatsby-plugin-google-gtag', - options: { - trackingIds: [ - process.env.GA_MEASUREMENT_ID, // GA Measurement - ], - gtagConfig: { - optimize_id: 'OPT_CONTAINER_ID', - anonymize_ip: true, - cookie_expires: 0, - }, - pluginConfig: { - head: true, - respectDNT: true, - }, - }, - }, + resolve: "gatsby-plugin-google-tagmanager", + options: { + id: process.env.GTM_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" }, + + // Name of the event that is triggered + // on every Gatsby route change. + // Defaults to gatsby-route-change + routeChangeEventName: "gatsby-route-change", + enableWebVitalsTracking: true, + }, + }, 'gatsby-plugin-react-helmet', 'gatsby-plugin-sitemap', { diff --git a/package.json b/package.json index 877bf4b..5bf97bc 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "flotiq-components-react": "^0.4.13", "gatsby": "^4.4.0", "gatsby-plugin-disqus": "^1.2.3", - "gatsby-plugin-google-gtag": "4", + "gatsby-plugin-google-tagmanager": "^4.25.0", "gatsby-plugin-hotjar": "^1.1.1", "gatsby-plugin-image": "^2.4.0", "gatsby-plugin-manifest": "^4.4.0", diff --git a/yarn.lock b/yarn.lock index 393b42f..9f6c7f6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5210,13 +5210,13 @@ gatsby-plugin-disqus@^1.2.3: resolved "https://registry.npmjs.org/gatsby-plugin-disqus/-/gatsby-plugin-disqus-1.2.3.tgz" integrity sha512-HjsMCGPt1qI/oryCw1NJjFS6XQ99eQmsXjrxxRi295sjlpvvcnNXlB11O7v4BbjNu2euqCY6XzK/fBkYJjjgCQ== -gatsby-plugin-google-gtag@4: +gatsby-plugin-google-tagmanager@^4.25.0: version "4.25.0" - resolved "https://registry.yarnpkg.com/gatsby-plugin-google-gtag/-/gatsby-plugin-google-gtag-4.25.0.tgz#cfea9ab34cb9c053440757e76f2863f2aad310bf" - integrity sha512-mzhjor5JYct1qQWLKayAHuyOHGHW3TT8Ns5fgdmSlqsmAR0X6dAh7zqSfqbvetGU309PZrRXeOrL92vjmeSIdQ== + 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" - minimatch "^3.1.2" + web-vitals "^1.1.2" gatsby-plugin-hotjar@^1.1.1: version "1.1.1" @@ -10612,6 +10612,11 @@ weak-lru-cache@^1.0.0: resolved "https://registry.npmjs.org/weak-lru-cache/-/weak-lru-cache-1.2.1.tgz" integrity sha512-O5ag1F0Xk6ui+Fg5LlosTcVAyHs6DeyiDDbOapNtFCx/KjZ82B3U9stM9hvzbVclKWn9ABPjaINX/nQkGkJkKg== +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.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"