marcvangend / gridsome-plugin-gtag

5 stars 0 forks source link

Not working? #2

Open rickbsgu opened 2 years ago

rickbsgu commented 2 years ago

I've implemented this in dual-tagging mode behind the Universal mode plugin: "@gridsome/plugin-google-analytics": "^0.1.2"

Getting data in the universal mode, not in the GA- mode.

Here's my config settings for both plugins:

    {
      use: '@gridsome/plugin-google-analytics',
      options: {
        id: 'UA-XXXXXXXXXX-X'
      }
    },
    {
      use: 'gridsome-plugin-gtag',
      options: {
        id: 'G-XXXXXXXXXX'
      }
    },

I've grep'ed the G- tag in the generated app-XXXX.js file and it is there, right behind the UA tag. So, seems like it's in the js and ought to work.

Watching it - is there any issue with running it in dual-tagging mode?

marcvangend commented 2 years ago

First of all, gridsome-plugin-gtag is very thin a wrapper around vue-gtag. Everything that is supported should be documented in the documentation over there.

Second, using those plugins simultaneously is beyond the intended use case of gridsome-plugin-gtag. @gridsome/plugin-google-analytics is a wrapper around vue-analytics, which has been deprecated for more than a year now, so supporting this dual setup (if that's the problem) is not a priority for me.

That said, your options object looks like this:

{
  id: 'G-XXXXXXXXXX'
}

but the documentation for this plugin says it should look like this:

{
  config: { id: "UA-XXXXXXXXX-X" },
}

Maybe changing that is all it takes to get it working the way you want it, but I cannot promise anything.

Another thought: You could also try using only gridsome-plugin-gtag and implementing both analytics ID's with a configuration as documented in Multiple domain tracking.

If you find a setup that works for your use case, please let us know!