Skip to content

Commit e425f65

Browse files
authored
Add example to A/B tests example Controller
1 parent 12ab052 commit e425f65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/Http/Controllers/ExampleController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ExampleController
1111
public function __invoke(Client $client)
1212
{
1313
try {
14-
$userId = uniqid();
14+
$userId = $_SESSION['userId'] ?? uniqid(); // $_SESSION['guestId'] here's for example. Always use some user id / guest id when sending event
1515
$buttonColor = $client->experiments()->run($userId, 'button_color');
1616
$client->statistics()->sendEvent(new EventDTO(
1717
null,

0 commit comments

Comments
 (0)