Gatsby: [gatsby-plugin-google-gtag]: Page and Title do not match in Analytics Dashboard

Created on 6 Feb 2019  ·  6Comments  ·  Source: gatsbyjs/gatsby

Description

gatsby-plugin-google-gtag records an event when the user navigates through the site. I can see the events in my Analytics Dashboard but the Page Title is 1 iteration behind.

In Google Analytics this shows as:

| Page | Page Title | Pageviews |
|----------|------------|-----------|
| / | (not set) | 1 |
| /page-1/ | Home | 1 |
| /page-2/ | Page 1 | 1 |
| /page-3/ | Page 2 | 1 |

Steps to reproduce

//gatsby-config.js
{
  resolve: `gatsby-plugin-google-gtag`,
  options: {
    trackingIds: [
      config.googleAnalyticsID, // Google Analytics / GA
    ],
    gtagConfig: {
      anonymize_ip: true,
      cookie_expires: 0,
    },
    pluginConfig: {
      head: false,
    },
  },
},

Environment

  System:
    OS: macOS 10.14.3
    CPU: (4) x64 Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.15.1 - ~/.nvm/versions/node/v10.15.1/bin/node
    npm: 6.7.0 - ~/.nvm/versions/node/v10.15.1/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 72.0.3626.96
    Firefox: 65.0
    Safari: 12.0.3
  npmPackages:
    gatsby: ^2.0.118 => 2.0.118 
    gatsby-image: ^2.0.29 => 2.0.29 
    gatsby-plugin-canonical-urls: ^2.0.10 => 2.0.10 
    gatsby-plugin-feed: ^2.0.13 => 2.0.13 
    gatsby-plugin-google-gtag: ^1.0.13 => 1.0.13 
    gatsby-plugin-manifest: ^2.0.17 => 2.0.17 
    gatsby-plugin-netlify: ^2.0.10 => 2.0.10 
    gatsby-plugin-netlify-cache: ^1.0.0 => 1.0.0 
    gatsby-plugin-netlify-cms: ^3.0.12 => 3.0.12 
    gatsby-plugin-no-sourcemaps: ^2.0.2 => 2.0.2 
    gatsby-plugin-offline: ^2.0.23 => 2.0.23 
    gatsby-plugin-react-helmet: ^3.0.6 => 3.0.6 
    gatsby-plugin-robots-txt: ^1.4.0 => 1.4.0 
    gatsby-plugin-sharp: ^2.0.20 => 2.0.20 
    gatsby-plugin-sitemap: ^2.0.5 => 2.0.5 
    gatsby-plugin-styled-components: ^3.0.5 => 3.0.5 
    gatsby-plugin-typescript: ^2.0.7 => 2.0.7 
    gatsby-remark-images: ^3.0.3 => 3.0.3 
    gatsby-remark-relative-images: ^0.2.1 => 0.2.1 
    gatsby-source-filesystem: ^2.0.20 => 2.0.20 
    gatsby-transformer-remark: ^2.2.4 => 2.2.4 
    gatsby-transformer-sharp: ^2.1.13 => 2.1.13 
  npmGlobalPackages:
    gatsby-cli: 2.4.9
good first issue confirmed question or discussion

Most helpful comment

https://github.com/gatsbyjs/gatsby/issues/9139 Google Analytics plugin has the same issue, it is about header tags update and events fire synchronisation issue.

All 6 comments

@krismorf Does this only occur for / or other pages as well?

I'm not sure but might be related to gatsby-plugin-offline and the initial app shell not having the meta stuff in head.

@sidharthachatterjee With gatsby-plugin-offline disabled the (not set) value is fixed but same behavior when navigating through pages.

Actually the (not set) value shows some times in the dashboard.

https://github.com/gatsbyjs/gatsby/issues/9139 Google Analytics plugin has the same issue, it is about header tags update and events fire synchronisation issue.

related to https://github.com/nfl/react-helmet/issues/189
also an issue with gatsby-plugin-google-tagmanager

I'd like to work on this 🙋‍♂️

@JacobBlomgren The way this is set up there is no clear way to me to turn off page level tracking. My use case is that I want to enable users the ability to opt out of tracking entirely. Is there any method to do that which I am missing?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

theduke picture theduke  ·  3Comments

jimfilippou picture jimfilippou  ·  3Comments

3CordGuy picture 3CordGuy  ·  3Comments

timbrandin picture timbrandin  ·  3Comments

ghost picture ghost  ·  3Comments