-
Notifications
You must be signed in to change notification settings - Fork 13
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
Persist landing page test tracking #6381
Conversation
Size Change: +1.71 kB (+0.07%) Total Size: 2.29 MB ℹ️ View Unchanged
|
Why would we not just target the landing page and checkout page? |
we don't want people who go straight to checkout to be included in the test - they must go via the landing page. We're sending quite a lot of users straight to checkout now. The existing setup for AB test targeting doesn't really support the 2-step flow correctly |
@@ -120,6 +122,7 @@ function init({ | |||
const urlParticipations = getParticipationsFromUrl(); | |||
const serverSideParticipations = getServerSideParticipations(); | |||
return { | |||
...sessionParticipations, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sessionParticipations
could be undefined
, can you use a spread operator on undefined
? I would've expected TS to complain here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. It appears you can spread on undefined - and here serverSideParticipations
and urlParticipations
are also potentially undefined.
I guess we could be a bit more deliberate about it with ...(sessionParticipations ?? {})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
DP have approved the use of the session storage item |
Excellent, this looks good to go for me then |
6eb8bdc
to
170e5c7
Compare
@@ -154,8 +163,10 @@ function getParticipations( | |||
mvtId: number, | |||
country: IsoCountry, | |||
countryGroupId: CountryGroupId, | |||
path: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this function easier to test, we now pass in a path
instead of using window.location.pathname
directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really nice, well done for providing tests 👍
Seen on PROD (merged by @tomrf1 12 minutes and 11 seconds ago)
Sentry Release: support-client-side, support |
Currently, if an AB test is targeted specifically at the landing page then the tracking doesn't carry through to the checkout. This means it doesn't get included in the acquisition event.
This PR fixes this by changing the landing page to add the AB test participations to session storage.
Subsequent pages will then pick up participations from session storage.
This is limited by the new
persistPage
field on the AB test model. A page will only pick up participations from session storage ifpersistPage
matches the current path.