From 619982e56c0e0b71687803a50bb93c455ad8adb0 Mon Sep 17 00:00:00 2001 From: Moris Zen Date: Wed, 5 Sep 2018 13:43:09 +0200 Subject: [PATCH] Adding google analytics with anon functionality for restricted areas --- gatsby-config.js | 10 ++++++++++ package.json | 1 + yarn.lock | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/gatsby-config.js b/gatsby-config.js index c7b5555..d374ca1 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -27,6 +27,16 @@ module.exports = { icon: 'src/images/favicon.png', // This path is relative to the root of the site. }, }, + { + resolve: `gatsby-plugin-google-analytics`, + options: { + trackingId: 'UA-125227964-1', + head: false, + anonymize: true, + respectDNT: true, + exclude: ['/preview/**', '/do-not-track/me/too/'], + }, + }, 'gatsby-transformer-sharp', 'gatsby-plugin-sharp', ], diff --git a/package.json b/package.json index 5db941b..97f6b73 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "gatsby": "^1.9.247", "gatsby-image": "^1.0.55", "gatsby-link": "^1.6.40", + "gatsby-plugin-google-analytics": "^1.0.31", "gatsby-plugin-manifest": "^1.0.27", "gatsby-plugin-netlify": "^1.0.21", "gatsby-plugin-offline": "^1.0.18", diff --git a/yarn.lock b/yarn.lock index f515cd8..1cb44f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3868,6 +3868,12 @@ gatsby-module-loader@^1.0.11: babel-runtime "^6.26.0" loader-utils "^0.2.16" +gatsby-plugin-google-analytics@^1.0.31: + version "1.0.31" + resolved "https://registry.yarnpkg.com/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-1.0.31.tgz#eaf16e1809461b10badf12c05038c429745783c0" + dependencies: + babel-runtime "^6.26.0" + gatsby-plugin-manifest@^1.0.27: version "1.0.27" resolved "https://registry.yarnpkg.com/gatsby-plugin-manifest/-/gatsby-plugin-manifest-1.0.27.tgz#148327ebfaf9a0a6791012cc5b5363356ee16ddf"