Skip to main content

A/B testing

Activate A/B testing

If you are using Uniform Canvas, A/B testing is handled automatically. However, if you are not using Canvas, you can still take advantage of testing, you just have to add it to your front-end application yourself.

The following example tests a component.

info

This code requires the following:

  1. The Uniform tracker is added to the front-end application.
  2. Manifest has an A/B test with the id dxcTest.
import { Test } from '@uniformdev/context-react';

const variants = [
{ text: 'DXC helps business users and developers collaborate better.' },
{ text: 'Business users need better tools to collaborate with developers.' },
{ text: 'Developers can work smarter when business users have the proper tools.' },
];

export function DxcTest() {
return (
<Test
name="dxcTest"
component={ContentBlock}
variations={variants}
/>
);
}

function ContentBlock({ text }) {
return (
<div>
{ text }
</div>
);
}

Handle tracker events

You can define event handlers for the events that are emitted from the Uniform tracker during the testing process.

Test result

info

Coming soon.