0
votes

I am currently working on a Gatsby project that is already using Google Tag Manager to handle Google Analytics. I would like to incorporate gatsby-plugin-guess-js with this site to help with performance, however without using gatsby-plugin-google-analytics I seem to be unable to achieve this.

We are currently using gatsby-plugin-google-tagmanager which does includes our GTM ID but this does not seem to be sufficient for guess-js to function.

Has anyone successfully achieved this or know a possible solution to this problem?

This is my Google Tag Manager and GuessJS config inside of gatsby-config.js

{
      resolve: `gatsby-plugin-google-tagmanager`,
      options: {
        id: "{GTM-ID}",
        includeInDevelopment: false,
      },
    },
    {
      resolve: "gatsby-plugin-guess-js",
      options: {
        // Find the view id in the GA admin in a section labeled "views"
        GAViewID: `{GA-VIEW-ID}`,
        minimumThreshold: 0.03,
        // The "period" for fetching analytic data.
        period: {
          startDate: new Date("2018-1-1"),
          endDate: new Date(),
        },
      },
    },

Expected: The expected functionality would be gatsby-plugin-guess-js using the ID from gatsby-plugin-google-tagmanager to bypass logging into our Google Analytics account during the build process.

Actual: During the build process a browser window is opened and I am prompted to login to my Google Analytics account to give access. This is fine locally, however not so fine while deploying the site.

1

1 Answers

0
votes

Guess.js and its plugin for Gatsby allow you to specify token instead of a GA ID.

For an example, you can see how the Gatsby team introduced Guess.js to https://gatsbyjs.org.

If you hit any issues during integration, don't hesitate to open an issue in the Guess.js or Gatsby's issue tracker.