Last active
June 24, 2022 11:58
-
-
Save yatsenkolesh/0124c56d22255496912661a3ed0824ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Abrouter\Client\Config\Config; | |
use DI\ContainerBuilder; | |
use Abrouter\Client\Client; | |
require '/app/vendor/autoload.php'; | |
$containerBuilder = new ContainerBuilder(); | |
$di = $containerBuilder->build(); | |
$token = '04890788ba2c89c4ff21668c60838a00a87b1cf42c9c6b45d6aa8e11174f0d5762b16b6c09b6b822'; //you can find your token in ABRouter dashboard | |
$di->set(Config::class, new Config($token, 'https://abrouter.com')); | |
/** | |
* @var Client $client | |
*/ | |
$client = $di->make(Abrouter\Client\Client::class); | |
$userSignature = $_SESSION['user_id'] ?? uniqid(); | |
$experimentId = 'button_color_test';//experiment id is also there | |
$runExperimentResult = $client->experiments()->run($userSignature, $experimentId); | |
$experimentId = $runExperimentResult->getExperimentId(); //form-color | |
$branchId = $runExperimentResult->getBranchId(); //red | |
echo '<button style="color: '. $branchId .'">Hello</button>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment