johannschopplich / nuxt-gtag

🔸 Google Tag integration for Nuxt: Google Analytics, Google Ads and more

Home Page:https://developers.google.com/tag-platform/gtagjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: Is this module supposed to track page views automatically?

mroddev opened this issue · comments

Environment


  • Operating System: Windows_NT
  • Node Version: v16.14.2
  • Nuxt Version: 3.2.3
  • Nitro Version: 2.2.3
  • Package Manager: npm@8.5.0
  • Builder: vite
  • User Config: runtimeConfig, modules, extends, css, vite, app, unhead, gtag
  • Runtime Modules: nuxt-gtag@0.2.2, @pinia/nuxt@0.4.7, nuxt-og-image@1.4.21
  • Build Modules: -

Reproduction

No Reproduction

Describe the bug

By following the Basic Usage instructions I'm not getting any tracking on google analytics 4 real time views dashboard.
I can see that the js file is being loaded on the 'network' tab on my website but the page views are not being tracked.

My nuxt.config file looks like this

export default defineNuxtConfig({
  ...
  modules: ["nuxt-gtag", ...],
  gtag: {
      id: 'G-XXXXXXXX', // My GA measurement ID
  },
  ...
}];

Sorry if this is normal behaviour and I'm supposed to do some more configuration.

Additional context

No response

Logs

No response

Yes, this module should track pages automatically, if you have set up Google Analytics with:

grafik

Are you trying locally or on the interweb? Maybe Google won't track page views for localhost, but only your configured domain.

Yes, this module should track pages automatically, if you have set up Google Analytics with:

grafik

Are you trying locally or on the interweb? Maybe Google won't track page views for localhost, but only your configured domain.

Weird, I'm doing it on a live website.
If I try it with the example from the Nuxt docs it works but with double entries, which is a problem.

When trying 'nuxt-gtag' with the above settings and with "Page changes based on browser history events" active, the analytics dashboard doesn't report anything back when you visit or navigate the website.

Seems like a bug. We will have to investigate that.

@mroddev Should be fixed in 69c7d61. Google's gtag.js requires using the arguments object inside the window.dataLayer array.

Please use v0.3.0 and test again. Thanks for the report!