React
For a complete overview of features in the React SDK check out the docs regarding those. For getting started read on.
Install
Setup
Configure the client
First let's generate our React handlers and expose them so we can import them in multiple places;
This makes it possible to import all React handlers from that file. First one we need is our provider that sits around your app;
Now we can start using the hooks in our application.
Consume the test value
Let's say we have the following Menu component;
And we want to know if people will find their way to the homepage without having the dedicated Home link. For this we can run an AB test like so;
Nice, now if we've setup the AB test as 50/50, then half of the visitors will now no longer see the homepage link in the navigation. But we will have no idea if people still get to the homepage.
Keep track of visitors
Next step is to send events to Improve on what the visitor is doing. Let' add two events;
- When the visitor sees the menu we mark the start of the AB test; "menuView"
- When the user clicks on a homepage link we mark the end of the AB test; "clickHomePageLink"
Let's also add a message to the click event, this way we can see the split between clicks on the logo and the navigation and the control.
Done!
Now it's time to publish your first AB test and measure what your visitors are doing!