Send a path, not full url, to trackers for pageviews #451
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For: https://trello.com/c/vISRi8lY/58-investigate-preventing-pii-being-sent-to-ga
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 cannow 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.
Page view analytics sent without this (e.g. using 7.3.0 and 7.4.0) are
broken without this change.