Skip to content

Commit

Permalink
Merge pull request #59 from flotiq/feature/move-to-gtm
Browse files Browse the repository at this point in the history
Move from gtag.js to GTM
  • Loading branch information
andrzejwp authored Feb 11, 2024
2 parents 564edd0 + 1f1c433 commit 7e8524e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
36 changes: 20 additions & 16 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 7e8524e

Please sign in to comment.