Pass Traffic Cop custom referrer to attribution scripts (Fixes #13593) #13621
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.
One-line summary
This PR fixes some existing holes in attribution data, where referrer was being lost when Traffic Cop performs a redirect.
Significant changes and points to review
I added a global
Mozilla.Analytics.getReferrer()
helper that other scripts can use to get referrer more reliably. It touches three places:Hopefully the tests I added can give some confidence that the value is now being passed as expected, but I also added some manual testing instructions below.
Issue / Bugzilla link
#13593
Testing
Note: test all the items below using a browser with DNT disabled.
Glean
GLEAN_LOG_PINGS=True
in your.env
.?v=1
or?v=2
in the URL.http://localhost:8000/en-US/firefox/new/
and nothttp://localhost:8000/en-US/
Stub attribution
?v=1
or?v=2
in the URL.Mozilla.StubAttribution.getAttributionData()
.referrer
ishttp://localhost:8000/en-US/firefox/new/
and nothttp://localhost:8000/en-US/
.FxA Attribution
I found this add-on useful for manual testing. With it you can override the referrer to any value you choose:
https://www.google.com/
, open http://localhost:8000/en-US/products/vpn/. You should be redirected into a traffic cop experiment withentrypoint_experiment=vpn-refresh-pricing
in the URLutm_source=google&utm_medium=organic