PHP code example of deseretdigital / cxense-insight-php-sdk
1. Go to this page and download the library: Download deseretdigital/cxense-insight-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/ */
deseretdigital / cxense-insight-php-sdk example snippets
use CxInsightSDK\Traffic;
$traffic = new Traffic(
'[email protected]',
'apikey'
);
// Get data for one week's time
$options = [
'start' => strtotime('-1 week'),
'stop' => time(),
'fields' => [
'events',
'uniqueUsers',
'urls',
'activeTime',
'sessionStarts',
'sessionStops',
'sessionBounces'
],
'filters' => [
[
'type' => 'event',
'group' => 'url',
'items' => ['http://example.com']
]
],
'siteIds' => [
'siteId'
]
];
$data = $traffic->getData($options);