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

Query string parameters not appearing in google analytics #229

Closed
HairMachine opened this issue Nov 2, 2020 · 5 comments
Closed

Query string parameters not appearing in google analytics #229

HairMachine opened this issue Nov 2, 2020 · 5 comments
Labels

Comments

@HairMachine
Copy link

Description

When visiting a page that contains query parameters, (such as /blah?foo=bar), the query parameters do not appear in the google analytics dashboard - so only /blah is appearing.

I believe this started happening when we switched from the original vue-analytics version of the library to this one; query parameters had previously been working fine.

I am not 100% sure whether this is expected behaviour and I'm missing some configuration, a bug in the library, or something strange with our implementation (although the vue site I'm seeing this occur on is very simple). Searching on google and probing the code hasn't got me anywhere so far.

Expected behavior

When the user visits a page that has query parameters, these are tracked and appear in the Google Analytics dashboard.

Actual behavior

The query parameters don't appear in the Google Analytics dashboard.

Environment

vue-gtag@1.10.0

Linux Mint 18 Sarah

Google Chrome 81.0.4044.129

@HairMachine
Copy link
Author

Update on this one: after probing further, I found downgrading the module to 1.6.4 fixes the problem. All versions above that seem to stop passing query strings.

@mrDlef
Copy link

mrDlef commented Jan 29, 2021

To resolve this I set pageTrackerSkipSamePath to false and give atemplate for pageTrackerTemplate like this :

...
        pageTrackerSkipSamePath: false,
        pageTrackerTemplate(to) {
          return {
            page_title: to.name,
            page_path: to.fullPath,
            page_location: window.location.href,
          };
        },
...

But it could be great to check the fullPath for duplicate too.

Maybe be it could be an option? I can help with a pull request if it make sens.

@MatteoGabriele
Copy link
Owner

MatteoGabriele commented Apr 11, 2021

@HairMachine sorry for the long-delayed response. I have added a new option that makes you use the fullPath instead of the path when you are dealing with automatic page tracking.

{
    // plugin options
    pageTrackerUseFullPath: true, // default is false
}

thanks for your feedback

@MatteoGabriele
Copy link
Owner

🎉 This issue has been resolved in version 1.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mrDlef
Copy link

mrDlef commented Apr 11, 2021

Thank you! :)

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

No branches or pull requests

3 participants