Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix($plugin-google-analytics): duplicate tracking of first page (fix #2017) #2039

Merged
merged 1 commit into from
Nov 27, 2019
Merged

fix($plugin-google-analytics): duplicate tracking of first page (fix #2017) #2039

merged 1 commit into from
Nov 27, 2019

Conversation

ajitzero
Copy link
Contributor

Fixes #2017
Reasoning in Issue.

@meteorlxy
Copy link
Member

Thanks for your contribution, but please do not delete the PR template next time.

I found another issue, and it would be better if we can solve it, too.

Scene 1

Open the homepage: https://deploy-preview-2039--vuepress.netlify.com/

image

Click "Get Started" (i.e. go to the guide page via vue-router):

image

dl param is wrong

Scene 2

Open the guide page directly: https://deploy-preview-2039--vuepress.netlify.com/guide/

image

dl param is correct

Conclusion

dl param is always pointing to the "previous" page.

Notice that dp param is useless here according to GA Docs, because we don't have a dh param together

@ajitzero
Copy link
Contributor Author

ajitzero commented Nov 27, 2019

I just checked it out.

dl param is always pointing to the "previous" page.

I tried opening other pages and switching multiple times. It's actually always pointing to the first page (whichever it may be) that we open. Only the dp changes at each router change.

The way it is currently written, the valid URL per route is the base URL (/ or ) + dp, concatenated. I'll look into the docs and get back to you shortly.

@ajitzero
Copy link
Contributor Author

@meteorlxy This seems to be the intended behavior to track the point of entry, after which the dp param holds the consequent path. This is not a bug, as it is. We will need to check the GA results (dashboard) for any inconsistencies.

@ajitzero ajitzero changed the title Deleted code for extra ping during init fix: duplicate tracking of first page Nov 27, 2019
@meteorlxy
Copy link
Member

@ajitzero

Hmmmm that's strange.

For 'pageview' hits, either &dl or both &dh and &dp have to be specified for the hit to be valid

But there is no dh to work together.

It seems that the behavior of "analytics.js" is not consistent with the documentation of "Measurement Protocol".

Alright, let's put this issue aside and merge this PR first.

Thanks for your contribution and investigation ❤️

@meteorlxy meteorlxy changed the title fix: duplicate tracking of first page fix($plugin-pwa): duplicate tracking of first page (fix #2017) Nov 27, 2019
@meteorlxy meteorlxy merged commit 1575820 into vuejs:master Nov 27, 2019
@meteorlxy
Copy link
Member

Oh fuck, wrong scope 😅 ....

@meteorlxy meteorlxy changed the title fix($plugin-pwa): duplicate tracking of first page (fix #2017) fix($plugin-google-analytics): duplicate tracking of first page (fix #2017) Nov 27, 2019
@vue-bot
Copy link

vue-bot commented Nov 27, 2019

Thanks again! 💚

@ajitzero
Copy link
Contributor Author

Glad I could contribute! Thank you 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dual Google Analytics Pings on Initial Page Load
3 participants