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

Page URL is not updated when using native Google Analytics SDK #49

Closed
pierreavizou opened this issue Apr 30, 2020 · 0 comments
Closed

Comments

@pierreavizou
Copy link
Contributor

pierreavizou commented Apr 30, 2020

When using Rudder's JS SDK as a source, and Google Analytics as a destination, configured to use Google's native SDK, there seem to be an issue tracking the page URL correctly.

We have a single page application, so we need to call rudderanalytics.page() explicitly when the URL changes. This correctly fires a call to Google Analytics endpoint, but the page URL that is sent is the one the user first landed on, and is not updated to reflect the new URL. Page title, however, is correctly updated and sent to Analytics.

On route change, we call Rudder's SDK like below:

trackPageview(location) {
     rudderanalytics.page('mypage', 'pagename', {
        path: location.pathname,
        search: location.search,
        title: document.title,
        url: window.location.href,
      }, {
        integrations: {
          Hotjar: false,
        },
      });
  }

It's worth noting that when using the Analytics in cloud mode, the very same code works perfectly.

The screenshot below illustrates that although the new page title is correctly sent to Analytics to indicate we're on a page about "concerts", the page URL is still the initial landing page's, about "artists".

Capture d’écran 2020-04-30 à 19 23 17

Basic steps to reproduce:

  • Configure rudder js sdk as a source, and Analytics as a destination with native SDK option activated
  • Landing page's URL should be tracked correctly
  • Push a new route to browser history without triggering a full page reload
  • Call rudderanalytics.page()
  • Check that the URL sent to Analytics has not been updated, but the title has

Feel free to let me know if I've missed something or can give you more information

pierreavizou added a commit to pierreavizou/rudder-sdk-js that referenced this issue Apr 30, 2020
sayan-rudder added a commit that referenced this issue May 1, 2020
Addresses issue #49: sets updated page data on GA tracker
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

No branches or pull requests

1 participant