1. Go to this page and download the library: Download clamp/analytics 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/ */
clamp / analytics example snippets
use Clamp\Analytics\Analytics;
use Clamp\Analytics\Money;
Analytics::init(
projectId: 'proj_xxx',
apiKey: getenv('CLAMP_API_KEY'),
);
// Simple event
Analytics::track('signup', ['plan' => 'pro', 'method' => 'email']);
// Link a server event to a browser visitor
Analytics::track(
'subscription_started',
[
'plan' => 'pro',
'total' => new Money(29.00, 'USD'),
],
anonymousId: 'aid_xxx',
);
Analytics::track('purchase', [
'plan' => 'pro',
'total' => new Money(29.00, 'USD'),
'tax' => new Money(4.35, 'USD'),
]);