-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send a path, not full url, to trackers for pageviews
When we track a page view that has no arguments, the default behaviour is for the trackers to work out the path by themselves from the window.location. In order for us to strip PII though we need to build an argument ourselves so we have something to strip PII from, and we then inject that into the arguments we send to the trackers. Prior to this change we were sending a full url, but the GA docs say that this argument should be a path, not a full url. In order to test this (stubbing window.location apears to be painful) we make the `defaultPathForTrackPageview` function take a location object, and we pass `window.location` into it at the call-sites. The tests can now pass an object in and we can test the function properly. These tests are a bit brittle because the location object we use only has the properties we use. Analytics sent without this (e.g. using v 7.3.0 and 7.4.0) are broken without this change.
- Loading branch information
Showing
3 changed files
with
41 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters