[gatsby-plugin-google-analytics] trackingId is required in development after upgrading to 3.0.0
See original GitHub issueDescription
Using gatsby-plugin-google-analytics
, it is noted in the docs that:
Note that this plugin is disabled while running gatsby develop. This way, actions are not tracked while you are still developing your project. Once you run gatsby build the plugin is enabled. Test it with gatsby serve.
Personally I keep my GA tracking id in netlify environment variable so it’s only available at build time. After upgrading to version 3.0.0 I get the following error message in development
ERROR #11331 PLUGIN
Invalid plugin options for “gatsby-plugin-google-analytics”:
- “trackingId” is required
Steps to reproduce
- Install
gatsby-plugin-google-analytics
version 3.0.0 - Start development process with
npm start
Expected result
The plugin should allow empty / undefined trackingId
in development.
Actual result
Error is thrown and development process is stopped.
Environment
System: OS: Windows 10 10.0.19042 CPU: (8) x64 Intel® Core™ i7-8550U CPU @ 1.80GHz Binaries: Node: 14.15.1 - C:\Program Files\nodejs\node.EXE npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.423.0), Chromium (88.0.705.81) npmPackages: gatsby: ^3.0.0 => 3.0.0 gatsby-plugin-google-analytics: ^3.0.0 => 3.0.0 gatsby-plugin-image: ^1.0.0 => 1.0.0 gatsby-plugin-manifest: ^3.0.0 => 3.0.0 gatsby-plugin-mdx: ^2.0.0 => 2.0.0 gatsby-plugin-netlify: ^3.0.0 => 3.0.0 gatsby-plugin-offline: ^4.0.0 => 4.0.0 gatsby-plugin-react-helmet: ^4.0.0 => 4.0.0 gatsby-plugin-robots-txt: ^1.5.5 => 1.5.5 gatsby-plugin-sharp: ^3.0.0 => 3.0.0 gatsby-plugin-sitemap: ^3.0.0 => 3.0.0 gatsby-plugin-styled-components: ^4.0.0 => 4.0.0 gatsby-remark-autolink-headers: ^3.0.0 => 3.0.0 gatsby-remark-copy-linked-files: ^3.0.0 => 3.0.0 gatsby-remark-embedder: ^4.1.0 => 4.1.0 gatsby-remark-images: ^4.0.0 => 4.0.0 gatsby-remark-prismjs: ^4.0.0 => 4.0.0 gatsby-source-filesystem: ^3.0.0 => 3.0.0 gatsby-transformer-sharp: ^3.0.0 => 3.0.0
I would like to submit a PR if needed (with maybe a little help of getting around) 🚀
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
You can use this pattern
I think this was intentional for the major bump: https://github.com/gatsbyjs/gatsby/pull/29413/files#diff-618b4bd7e0c4df7c7818d36a3f92517c9ceb898b635b72da933dc09ab7d4b9f8
But I don’t have enough context on it. CC @wardpeet @laurieontech