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

Send a path, not full url, to trackers for pageviews #451

Merged
merged 1 commit into from
Feb 15, 2018

Conversation

h-lame
Copy link
Contributor

@h-lame h-lame commented Feb 15, 2018

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 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.

Page view analytics sent without this (e.g. using 7.3.0 and 7.4.0) are
broken without this change.

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.

Pageview analytics sent without this (e.g. using 7.3.0 and 7.4.0) are
broken without this change.
@h-lame h-lame force-pushed the send-path-not-url-to-trackers-as-default-page-view branch from cc35c96 to c1ab5de Compare February 15, 2018 13:18
Copy link
Contributor

@36degrees 36degrees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@h-lame h-lame merged commit 33bba7a into master Feb 15, 2018
@h-lame h-lame deleted the send-path-not-url-to-trackers-as-default-page-view branch February 15, 2018 14:33
h-lame added a commit that referenced this pull request Feb 15, 2018
This fixes the analytics for tracking pageviews by sending a path, not a
full url (see: #451) and includes a new github key for deploys (see: #450
and #452).
@h-lame h-lame mentioned this pull request Feb 15, 2018
h-lame added a commit that referenced this pull request Feb 15, 2018
This fixes the analytics for tracking pageviews by sending a path, not a
full url (see: #451) and includes a new github key for deploys (see: #450
and #452).
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.

2 participants