Giter VIP home page Giter VIP logo

Comments (12)

johannschopplich avatar johannschopplich commented on June 8, 2024 2

@ttonyh I have just released v0.5.6 with the manual tracking removed.

If another issue persists, please open a separate issue.

from nuxt-gtag.

johannschopplich avatar johannschopplich commented on June 8, 2024 1

I have incorporated the initial page_view into the plugin itself. Available in v0.5.5.
Please test it. Feedback much appreciated!

from nuxt-gtag.

johannschopplich avatar johannschopplich commented on June 8, 2024 1

@ttonyh Thanks for verifying. I believe so, too, since gtag.js will handle tracking all by itself. If someone wants to force the initial page_view, he may do so manually:

if (process.client) {
  // Send initial `page_view` event
  useGtag('event', 'page_view', {
    page_location: window.location.href,
    page_path: useRoute().path,
    page_title: document.title,
  })
}

So everyone is happy. 🙂

from nuxt-gtag.

soylomass avatar soylomass commented on June 8, 2024

Same issue

from nuxt-gtag.

johannschopplich avatar johannschopplich commented on June 8, 2024

Mmmh… That's unfortunate. Any idea why Google Analytics might not pick up the initial page_view?

from nuxt-gtag.

notflip avatar notflip commented on June 8, 2024

Is this being looked at? I feel like this is a major bug.

from nuxt-gtag.

johannschopplich avatar johannschopplich commented on June 8, 2024

It seems that the module is correctly setting up Google Analytics, but it's not sending the initial page_view event. You can manually track the initial visit by sending a page_view event after the Google Analytics script is loaded.

// Send initial `page_view` event
useGtag('event', 'page_view', {
  page_location: window.location.href,
  page_path: useRoute().path,
  page_title: document.title,
})

from nuxt-gtag.

soylomass avatar soylomass commented on June 8, 2024

Thanks for the quick fix!
In my case, sending events has never worked with this plugin (or GA4?) unless I add send_to: 'G-...' to the event parameters, so that piece of code won't work.
Has anyone experienced the same problem?

from nuxt-gtag.

johannschopplich avatar johannschopplich commented on June 8, 2024

@soylomass Are you sure the GA ID is set in your nuxt.config.ts? Please create a separate issue including your Nuxt configuration if that issue persists. Thanks!

from nuxt-gtag.

mroddev avatar mroddev commented on June 8, 2024

I have incorporated the initial page_view into the plugin itself. Available in v0.5.5. Please test it. Feedback much appreciated!

Thanks for the update.
I just tested it and it still does not seem to work.. In incognito and first page load, analytics only gets the event name 'first_visit'. The 'page_view' is still not being recognised by Google Analytics.

from nuxt-gtag.

ttonyh avatar ttonyh commented on June 8, 2024

@mroddev Have you tried verifying the page_view event by using the Google Analytics Debugger extension:

https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna

It seems to be working based on the output of the extension.

More info for debugging:
https://support.google.com/analytics/answer/7201382?hl=en

from nuxt-gtag.

ttonyh avatar ttonyh commented on June 8, 2024

@johannschopplich I think the addition is causing the page_view to register twice.

from nuxt-gtag.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.