[DO NOT MERGE] [WSTEAM1-102] Server Side Optimizely Integration
Resolves WSTEAM1-102
Overall change: Adds support for new MVT experiment headers.
Code changes:
- Adds logic to the server to extract mvt headers in a consumable format, with logic to add an enabled key which cross-checks a predetermined list and inserts this data into the page data.
- Adds logic to the server to add the correct vary header values to the response for caching.
- Adds a dummy enabled experiment list.
- Enables the mvt experiment data to be made available via the request context.
- Adds experiment activation code on the client, and forces the user into the given variation.
- Adds example experiment, which can be seen on pidgin STY pages http://localhost:7080/pidgin/58228654.
- Updates and adds unit tests.
- [x] I have assigned myself to this PR and the corresponding issues
- [ ] I have added the
cross-teamlabel to this PR if it requires visibility across World Service teams - [ ] I have assigned this PR to the Simorgh project
- [x] (BBC contributors only) This PR follows the repository use guidelines
Testing:
- [x] Automated (jest and/or cypress) tests added (for new features) or updated (for existing features)
- [ ] If necessary, I have run the local E2E non-smoke tests relevant to my changes (
CYPRESS_APP_ENV=local CYPRESS_SMOKE=false yarn test:e2e:interactive) - [ ] This PR requires manual testing
Thoughts on using the Optimizely Event API, instead of using the hefty Optimizely SDK to send events client-side? Seems super simple https://docs.developers.optimizely.com/optimizely-data/docs/event-api-getting-started? Would save 100k in the bundle size if we don't have client-side experiments enabled on the page.
Is it worth creating a new ExperimentContext solely for experimentation rather than passing the values through RequestContext? Just to keep it isolated more than anything.
Is it worth creating a new
ExperimentContextsolely for experimentation rather than passing the values throughRequestContext? Just to keep it isolated more than anything.
Can do if you think it's beneficial? I passed it down via request similar to the other stuff we add to the page data
Is it worth creating a new
ExperimentContextsolely for experimentation rather than passing the values throughRequestContext? Just to keep it isolated more than anything.Can do if you think it's beneficial? I passed it down via request similar to the other stuff we add to the page data
Its probably alright keeping it in the RequestContext the more I think about it, since it will be set by header values 👍🏼