MatteoGabriele / vue-gtag

Global Site Tag plugin for Vue (gtag.js)
https://matteo-gabriele.gitbook.io/vue-gtag/
MIT License
864 stars 64 forks source link

1.6.3 seems to stop reporting data #144

Closed mattias-persson closed 4 years ago

mattias-persson commented 4 years ago

Description

Upgrading from 1.6.2 to 1.6.3 completely stopped the reporting of data.

Expected behavior

Data should be reported as before.

Actual behavior

The analytics dashboard reports 0 active people and 0 events in real time.

Environment

Run this command in the project folder and fill in their results:

npm ls vue-gtag:

Then, specify:

  1. Operating system: MacOS 10.15.5
  2. Browser and version: Chrome 83.0.4103.97
MatteoGabriele commented 4 years ago

I think that I know why. there was this complain of an extra hit on load all the time so I removed it from the bootstrap, but then I saw that the library method $gatg.pageview is using gtag page_view event which doesn't send the ID on hit. I will look into it asap

thanks for the feedback

MatteoGabriele commented 4 years ago

I have to admit: gtag.js documentation is still quite mysterious sometimes. they could have done a better job. especially for SPA

MatteoGabriele commented 4 years ago

:tada: This issue has been resolved in version 1.6.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

shumiyao commented 3 years ago

@MatteoGabriele

Hasn't this issue recurred with recent versions including vue-gtag 1.9.1?

I found out that https://www.google-analytics.com/j/collect?v=1&_... does not get loaded with the version 1.9.1 while specifying the version to 1.6.4 in the package.json allows the collect script to be loaded.

The collect script seems to be necessary for the Google Analytics Realtime report to work.

MatteoGabriele commented 3 years ago

@shumiyao I'm not sure about that script there, but there's nothing indicating the need to load a second script while bootstrapping gtag.js

shumiyao commented 3 years ago

@MatteoGabriele

Thank you very much for a response.

We do not need to load the "collect" script at all. It is loaded automatically when we load https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-XX

The access to collect script is not requested when I use the latest of 1.9.1 but it works when I specify the vue-gtag version of 1.6.4. Can it be related to vue-gtag?

MatteoGabriele commented 3 years ago

still not quite sure, but 6 new version have been published after 1.6.4, can you identify after which one this stops working for you, then will be easier to identify a possible cause of this malfunctioning

shumiyao commented 3 years ago

Sure. I will try by this evening.

MatteoGabriele commented 3 years ago

thanks a lot for you help @shumiyao really appreciated

shumiyao commented 3 years ago

@MatteoGabriele

I compared outputs between 1.64 and all other 5 versions. All the version after 1.7.0 do not seem to work with the Google Analytics.

The only differences I could find were whether 2&l=dataLayer is included in the url (www.googletagmanager.com/gtag/js?) or not:

Screen Shot 2020-10-13 at 12 55 48 PM
MatteoGabriele commented 3 years ago

@shumiyao but the &l={DATALAYER_NAME} is supported by the official documentation https://developers.google.com/gtagjs/devguide/datalayer#rename

shumiyao commented 3 years ago

@MatteoGabriele

That was the only difference I could find between different versions. Any chance that we could suppress the DATALAYER_NAME?

MatteoGabriele commented 3 years ago

I will have a look later. Thanks for your debugging

shumiyao commented 3 years ago

@MatteoGabriele I did not do anything at all. Thank you for your attention and your time. Have a nice day!