Skip to content

Instantly share code, notes, and snippets.

@yatsenkolesh
Last active June 23, 2022 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yatsenkolesh/bcb041118bc538b66d3e5b89d6f937b9 to your computer and use it in GitHub Desktop.
Save yatsenkolesh/bcb041118bc538b66d3e5b89d6f937b9 to your computer and use it in GitHub Desktop.
<?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