Last active
June 23, 2022 23:34
-
-
Save yatsenkolesh/bcb041118bc538b66d3e5b89d6f937b9 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\Client; | |
use Abrouter\Client\Builders\StatEventBuilder; | |
class ExampleController | |
{ | |
public function __invoke(Client $client, StatEventBuilder $statEventBuilder) | |
{ | |
$userId = auth()->user()->id; | |
//sending button_click event as button_click+1 | |
$client->statistics()->sendEvent( | |
$eventBuilder | |
->incremental() | |
->event('button_click') | |
->setUserId($userId) | |
->build() | |
); | |
//sending button_click event as button_click+1 | |
$client->statistics()->sendEvent( | |
$eventBuilder | |
->summarize() | |
->event('purchase') | |
->setValue(30) | |
->setUserId($userId) | |
->build() | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment