PHP code example of cdnsteve / segment-php-sdk
1. Go to this page and download the library: Download cdnsteve/segment-php-sdk 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/ */
cdnsteve / segment-php-sdk example snippets
CdnSteve\Segment\Segment;
use CdnSteve\Segment\Analytics;
Segment::config([
'api_key' => 'YOUR_API_KEY',
'timeout' => 2.0, // HTTP request in seconds.
]);
// Setup unique identity to track.
Analytics::identify([
'userId'=> '5114'
]);
// Track it!
Analytics::track([
'userId'=> '5114',
'event' => 'Purchase item',
'properties' => [
'product' => 'Solution 10',
'premium_frequency' => 'monthly',
'insurance_coverage' => 250000,
'premium' => 50.35,
]
]);