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

WORLDSERVICE-112 - Optimizely set-up for Top Bar OJ experiment #12529

Merged

Conversation

louisearchibald
Copy link
Contributor

@louisearchibald louisearchibald commented Mar 19, 2025

Resolves JIRA [112]

Overall changes

Implementing the set-up required to run the server-side Optimizely Top Bar OJ experiment.

Code changes

  • Updates isClientSide to be true inside of the useOptimizelyVariation hook.
  • Sets up Optimizely variation inside of ScrollablePromo component and ArticlePage.
  • Updates the enabledExperimentList with correct key name of the experiment and adds the services it will be rolled out to to the services array.
  • Updates tracking description values with an appropriate experiment name.

@louisearchibald louisearchibald self-assigned this Mar 19, 2025
@louisearchibald louisearchibald marked this pull request as ready for review March 20, 2025 14:35
…nt' of github.com:bbc/simorgh into WORLDSERVICE-112-optimizely-set-up-for-top-bar-experiment
@amoore108
Copy link
Contributor

amoore108 commented Mar 20, 2025

@louisearchibald To test the variations, you can use the ModHeader extension in Chrome and set a new Request Header to:
mvt-top_bar_oj_experiment with a value of experiment;A or experiment;B, whichever variation you want to see.

It needs the mvt- prefix as thats what the upstream service does, but only in the request header, we don't need to change the experiment name to include that prefix ourselves.

Once you do that, if you resize your window down you should then see the top bar OJ.

@amoore108
Copy link
Contributor

Looks great!

Could you add in a check that the optimizely context is available in:

So something like:

if (onClient() && optimizely) {

I got an error that onReady was trying to be accessed from null, so that check should just ensure that optimizely is available before attempting to run functions on it.

@amoore108
Copy link
Contributor

Realised as well we'll need to pass in optimizely into the view/click trackers:

const { script, service, dir, translations, mostRead } =
useContext(ServiceContext);
const eventTrackingData = {
componentName: `edoj${blockGroupIndex}`,
format: 'CHD=edoj',
};

You can grab it from the OptimizelyContext and conditionally add the entire optimizely prop to the eventTrackingData object there.

@amoore108 amoore108 merged commit b763f6a into latest Mar 24, 2025
11 checks passed
@amoore108 amoore108 deleted the WORLDSERVICE-112-optimizely-set-up-for-top-bar-experiment branch March 24, 2025 10:54
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.

4 participants