Skip to content

[gatsby-plugin-google-analytics] trackingId is required in development after upgrading to 3.0.0 #29939

@talohana

Description

@talohana

Description

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(R) Core(TM) 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) 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    stale?Issue that may be closed soon due to the original author not responding any more.topic: plugins-analyticsVarious analytics plugins like gatsby-plugin-google-analyticstype: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions