1. Go to this page and download the library: Download alitycs/alitycs-sdk-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alitycs / alitycs-sdk-php example snippets
use Alitycs\Client;
use Alitycs\RevenuePayload;
$alitycs = new Client('pk_live_…', [
'endpoint' => 'https://api.alitycs.com/events',
'flushSize' => 20,
]);
$alitycs->identify('usr_1842', ['plan' => 'pro']);
$alitycs->track('signup_completed', ['plan' => 'free']);
$alitycs->page('Dashboard');
$alitycs->captureError('checkout_failed', ['code' => 'E_CARD']);
$alitycs->trackRevenue(RevenuePayload::transaction('fact_1', '19.99', 'USD'));
$alitycs->setGlobalProperties(['suite' => 'checkout']);
$alitycs->reset(); // rotates session + anonymous id, clears the user
$alitycs->shutdown(); // or let script shutdown deliver the remainder
// e.g. Laravel Octane: in a middleware or the ListenForEventsTick listener
$app->middleware(function ($request, $next) use ($alitycs) {
$alitycs->resetForRequest(); // clears user id, global properties, session identity
return $next($request);
});