From 2190a8a9a597a684cb77acc298991433218ebf36 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 10 Nov 2020 16:52:26 +0100 Subject: [PATCH] move analytics id to environment variable (#238) --- .env.example | 1 + app.config.js | 5 ++++- gatsby-config.js | 2 +- src/hooks/useSiteMetadata.ts | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 5dbecc20e..c3991a5f6 100644 --- a/.env.example +++ b/.env.example @@ -3,3 +3,4 @@ GATSBY_NETWORK="rinkeby" #GATSBY_INFURA_PROJECT_ID="xxx" #GATSBY_MARKET_FEE_ADDRESS="0xxx" +#GATSBY_ANALYTICS_ID="xxx" \ No newline at end of file diff --git a/app.config.js b/app.config.js index 6801d707d..306d167ea 100644 --- a/app.config.js +++ b/app.config.js @@ -32,5 +32,8 @@ module.exports = { classNameDark: 'dark', classNameLight: 'light', storageKey: 'oceanDarkMode' - } + }, + + // Analytics + analyticsId: process.env.GATSBY_ANALYTICS_ID || 'xxx' } diff --git a/gatsby-config.js b/gatsby-config.js index a98dcd013..62f419d40 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -71,7 +71,7 @@ module.exports = { resolve: 'gatsby-plugin-google-analytics', options: { // The property ID; the tracking code won't be generated without it - trackingId: 'UA-60614729-11', + trackingId: appConfig.analyticsId, // Defines where to place the tracking script - `true` in the head and `false` in the body head: false, // Setting this parameter is optional diff --git a/src/hooks/useSiteMetadata.ts b/src/hooks/useSiteMetadata.ts index 4aa5fb6fc..6f51fa8fe 100644 --- a/src/hooks/useSiteMetadata.ts +++ b/src/hooks/useSiteMetadata.ts @@ -19,6 +19,7 @@ const query = graphql` network marketFeeAddress currencies + analyticsId } } }