Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gatsby-plugin-google-tagmanager specifying dataLayerName results in js error: "Uncaught TypeError: Cannot read property 'push' of undefined" #20536

Closed
dewen opened this issue Jan 10, 2020 · 0 comments · Fixed by #20551
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@dewen
Copy link
Contributor

dewen commented Jan 10, 2020

Description

Specifying a different dataLayerName from default "dataLayer" in plugin options results in js error: "Uncaught TypeError: Cannot read property 'push' of undefined".

Steps to reproduce

  1. install plugin gatsby-plugin-google-tagmanager
npm install --save gatsby-plugin-google-tagmanager
  1. Update gatsby-config.js with new plugin options, set dataLayerName with custom value:
{
    resolve: "gatsby-plugin-google-tagmanager",
    options: {
      [...]
      dataLayerName: "myDataLayer",
    },
  1. Run build and serve.

Expected result

(No JS error)

Actual result

JS error:

Uncaught TypeError: Cannot read property 'push' of undefined
    at gatsby-browser.js:6

Environment


  System:
    OS: macOS 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.9.1 - ~/.nvm/versions/node/v12.9.1/bin/node
    Yarn: 1.19.0 - /usr/local/bin/yarn
    npm: 6.10.2 - ~/.nvm/versions/node/v12.9.1/bin/npm
  Languages:
    Python: 2.7.16 - /usr/local/bin/python
  Browsers:
    Chrome: 79.0.3945.117
    Safari: 13.0.3
  npmPackages:
    gatsby: ^2.0.21 => 2.15.14 
    gatsby-image: ^2.0.5 => 2.2.18 
    gatsby-plugin-algolia: ^0.1.0 => 0.1.1 
    gatsby-plugin-catch-links: ^2.0.2 => 2.1.9 
    gatsby-plugin-feed: ^2.0.5 => 2.3.12 
    gatsby-plugin-google-analytics: ^2.0.6 => 2.1.16 
    gatsby-plugin-google-tagmanager: ^2.1.23 => 2.1.23 
    gatsby-plugin-layout: ^1.0.2 => 1.1.7 
    gatsby-plugin-manifest: ^2.0.2 => 2.2.16 
    gatsby-plugin-netlify: ^2.0.0 => 2.1.12 
    gatsby-plugin-offline: ^2.0.6 => 2.2.10 
    gatsby-plugin-react-helmet: ^3.0.0 => 3.1.7 
    gatsby-plugin-react-svg: ^2.0.0 => 2.1.2 
    gatsby-plugin-sharp: ^2.0.5 => 2.2.21 
    gatsby-plugin-sitemap: ^2.0.1 => 2.2.12 
    gatsby-plugin-styled-jsx: ^3.0.1 => 3.1.6 
    gatsby-plugin-styled-jsx-postcss: ^2.0.2 => 2.0.2 
    gatsby-remark-copy-linked-files: ^2.0.5 => 2.1.19 
    gatsby-remark-emojis: ^0.2.3 => 0.2.5 
    gatsby-remark-external-links: ^0.0.4 => 0.0.4 
    gatsby-remark-images: ^2.0.1 => 2.0.6 
    gatsby-remark-prismjs: ^3.0.0 => 3.3.13 
    gatsby-remark-responsive-iframe: ^2.0.5 => 2.2.16 
    gatsby-remark-smartypants: ^2.0.5 => 2.1.8 
    gatsby-source-filesystem: ^2.0.1 => 2.1.22 
    gatsby-transformer-remark: ^2.1.3 => 2.6.22 
    gatsby-transformer-sharp: ^2.1.1 => 2.2.14 
@blainekasten blainekasten added effort: low type: bug An issue or pull request relating to a bug in Gatsby labels Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants