How to implement A/B | split tests on Laravel?

The ABRouter is an open-source, developer-oriented tool for implementing managed A/B tests with high-level Laravel support.
The service providing a clear web interface to manage experiments, powerful API to run and track results of the tests in your Laravel application.
Installing via composer package for Laravel.
Takes minutes to start your first A/B test. Additionally, we have the packages for vanilla PHP and Symfony:

PHP guide
Symfony Guide


Start for free

Image

Why do we need A/B tests?

Long story short - to improve conversions. The main advantage of AB-testing is making the right decisions.

Real world example: you have a two implementations of free trials on your website. In the first case, you require a card number to sign up, and for the second your user can proceed to the platform without the card. What is the best choice in that case?

AB test with two branches can show you the right answer. Your decision will be based on the number of completed sign-ups and the final number of the paid users in these branches.

Start for free
Image

Our first task with A/B test

Task definition
Our task is testing the most convertible color of form button. For example, your current color of sign up button is blue, but you want to check, what if the green button will be more convertible?
Goal:
to test most convertible color of form button
Branches:
red - 33%, green - 33%, blue - 33%.
Technically:
assign the color of the button: which the user got into.

Creating first A/B test on ABR side

So, there are the step to be done:
Step 1: Sign-up by the link
Step 2: Create your experiment
Pay attention to the Experiment ID. You will use it as the identifier of experiment to run it.
Step 3: Grab the data
After creating the A/B test you can to get the important data to run it.
Experiment id:

Token:

Application side | Start coding

Step 1: Install
Install the library to your codebase on PHP: https://github.com/abrouter/laravel-abtest
This library based on main ABRouter client: https://github.com/abrouter/abrouter-php-client
1
Install the package:
composer require abrouter/laravel-abtest

This package provide auto discovery for service provider. If Laravel package auto-discovery is disabled, add service providers manually in your /app/app.php of your repository.

There are service providers you must add:

\Abrouter\LaravelClient\Providers\AbrouterServiceProvider::class
2
Publish client configuration:
php artisan vendor:publish --tag=abrouter
3
Configure the client:
There you have to put your ABRouter token from your dashboard which is described in the third point.
Step 2: Code
Now we are ready to code. Also, you can check an example of fully completed code on GitHub:
https://github.com/abrouter/laravel-example
Step 3: There is our results
Color of the button will be automatically changed on each request for every page reload. Because we have used uniqid(). ABRouter system will memorize the relation between user identifier and branch he got, so if we will repeat the request with the same user identifier we will get the same branch as on previous run.

Getting started is easy

Find key retention drivers with ABRouter
Create your first A/B test

Summary

I have shown you how to implement an A/B test with Laravel framework via ABRouter. Looks like it's quite simple.
Please, remember, that every change that you are making to the app should be through an A/B test. It's a key to build a successful product.

If you have any questions, feel free to ask me at abrouter@proxiedmail.com

Image
Alex Yatsenko Senior Developer at ABRouter