Description and step-by-step instructions on how we implemented A/B testing on the Strapi.io website.
For this purpose, we will use Amplitude's Experiment. The Experiment creation goes as follows:
In the Amplitude dashboard, you can then see the results of the experiments in a very intuitive way:
In this blog post, we will focus on “Create a variant” and its implementation in the front-end app.
Create an environment where the marketing team can make A/B testing experiments with minimal to no development required. This needs to be done using the Amplitude Experiment JavaScript SDK.
You can approach this in multiple ways:
The decision was to go with the global wrapper route,
1// _app.js
2import ExperimentProvider from 'src/components/shared/ExperimentProvider'
3
4...
5<ExperimentProvider>
6...
7</ExperimentProvider>
8... In the components, we introduce the experiment key, with previously defined keys like message or class that will be applied to the components.
If the key is present, the corresponding text or styling is going to be applied to the components.
Above, you see an experiment field as a reference for the Amplitude dashboard.
The images above show the two versions: A - white button, B - blue button.
The solution above is a good solution for a big existing application, where we want to introduce A/B testing.
When a key is present in a component, it will find its variants. If the variant is there, the colour or text, or any other aspect of the elements, can be modified by the marketing team.
Loading all the variants on page load can be a problem long-term for the page load speed.
If there is a way to prepare the UI to load the variants when the component is actually loaded, that would be a better solution.
I help scale-ups move to headless CMS (Strapi) for faster corporate websites and higher conversions | The Strapi CMS Guy | Founder of NOTUM