deseretdigital/cxense-insight-php-sdk

此包已被 废弃 并不再维护。没有建议替代包。

用于与 Cxense Insight API 交互的库

v2.4.0 2017-09-08 03:19 UTC

This package is not auto-updated.

Last update: 2022-04-29 04:20:38 UTC


README

通过 composer 安装

composer.json 中添加 SDK 到你的 require

"require": {
    "deseretdigital/cxense-insight-php-sdk": "~2.1"
}

运行 composer install

如果你不熟悉 composer,可以在这里了解它 https://getcomposer.org.cn/

使用方法

include __DIR__ . '/vendor/autoload.php';

use CxInsightSDK\Traffic;

$traffic = new Traffic(
    'test@example.com',
    '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);

有关可以发送到 cxense API 的选项/参数的更多信息,请参阅 Cxense API Wiki

注意:目前此 SDK 仅支持以下 cxense API 端点(可以轻松添加其他端点):/traffic/traffic/event/traffic/data/traffic/custom/dmp/traffic/dmp/traffic/event/dmp/traffic/custom/document/search/document/update/profile/content/delete/reports/search/reports/search/usage