dev-master
9999999-devPHP SDK for Adjust API
MIT
The Requires
- php >=5.5.9
The Development Requires
by Firsov Dmitry
v0.1
0.1.0.0PHP SDK for Adjust API
The Requires
- php >=5.5.9
The Development Requires
by Firsov Dmitry
Wallogit.com
2017 © Pedro Peláez
PHP SDK for Adjust API
Official doc, (*1)
A note - do not read a rus variant of the docs, cause some not translated docblock just dropped, (*2)
This SDK not fully implemented according to the official doc Feel free to add a new code to the SDK, but do not forget about unit tests, (*3)
The default is:
+ response as JSON", "CSV" not implemented
+ time zone of account's, (*4)
Adjust's API does not support a query to fetch list of applications, (*5)
via composer.json, (*6)
"require": {
"f-dg/adjust-api-sdk": "dev-master"
}
or via git clone, (*7)
git clone git@github.com:f-dg/adjust-api-sdk.git
use \AdjustKPIService\OverviewStatistics,
\AdjustKPIService\OverviewStatisticsValues as Params,
\AdjustKPIService\adapter\CurlAdapter,
\AdjustKPIService\AdjustKPIServiceException;
try {
$curlAdapter = new CurlAdapter;
$apiConfig = [
'user_token' => 'token1',
'app_token' => 'token2',
];
$startTimestamp = strtotime('-30 days');
$endTimestamp = time();
$params = new Params;
$overviewStats = new OverviewStatistics($curlAdapter, $apiConfig);
$data = $overviewStats->getData([
Params::REQUEST_PARAM_UTC_OFFSET => '00:00',
Params::REQUEST_PARAM_START_DAY => $params->formatRequestDate($startTimestamp),
Params::REQUEST_PARAM_END_DAY => $params->formatRequestDate($endTimestamp),
Params::REQUEST_PARAM_KPIS => $params->getAppKPIListForRequest(),
Params::REQUEST_PARAM_EVENT_KPIS => $params->getEventKPIListForRequest(),
Params::REQUEST_PARAM_GROUPING => join(',', [Params::REQUEST_VALUE_GROUPING_TRACKER]),
]);
print_r($data);
} catch (AdjustKPIServiceException $e) {
echo 'An error occurred: ' . PHP_EOL . $e->getMessage() . PHP_EOL;
}
use \AdjustKPIService\EventStatistics,
\AdjustKPIService\EventStatisticsValues as Params,
\AdjustKPIService\adapter\CurlAdapter,
\AdjustKPIService\AdjustKPIServiceException;
try {
$curlAdapter = new CurlAdapter;
$apiConfig = [
'user_token' => 'token1',
'app_token' => 'token2',
];
$startTimestamp = strtotime('-30 days');
$endTimestamp = time();
$params = new Params;
$eventStats = new EventStatistics($curlAdapter, $apiConfig);
$data = $eventStats->getData([
Params::REQUEST_PARAM_UTC_OFFSET => '00:00',
Params::REQUEST_PARAM_START_DAY => $params->formatRequestDate($startTimestamp),
Params::REQUEST_PARAM_END_DAY => $params->formatRequestDate($endTimestamp),
Params::REQUEST_PARAM_KPIS => $params->getEventKPIListForRequest(),
Params::REQUEST_PARAM_GROUPING => join(',', [
Params::REQUEST_VALUE_GROUPING_TRACKER,
Params::REQUEST_VALUE_GROUPING_COUNTRIES,
Params::REQUEST_VALUE_GROUPING_DAY,
]),
]);
print_r($data);
} catch (AdjustKPIServiceException $e) {
echo 'An error occurred: ' . PHP_EOL . $e->getMessage() . PHP_EOL;
}
use \AdjustKPIService\CohortStatistics,
\AdjustKPIService\CohortStatisticsValues as Params,
\AdjustKPIService\adapter\CurlAdapter,
\AdjustKPIService\AdjustKPIServiceException;
try {
$curlAdapter = new CurlAdapter;
$apiConfig = [
'user_token' => 'token1',
'app_token' => 'token2',
];
$startTimestamp = strtotime('-30 days');
$endTimestamp = time();
$params = new Params;
$cohortStats = new CohortStatistics($curlAdapter, $apiConfig);
$data = $cohortStats->getData([
Params::REQUEST_PARAM_UTC_OFFSET => '00:00',
Params::REQUEST_PARAM_START_DAY => $params->formatRequestDate($startTimestamp),
Params::REQUEST_PARAM_END_DAY => $params->formatRequestDate($endTimestamp),
Params::REQUEST_PARAM_KPIS => $params->getCohortKPIListForRequest(),
Params::REQUEST_PARAM_GROUPING => join(',', [
Params::REQUEST_VALUE_GROUPING_TRACKER,
Params::REQUEST_VALUE_GROUPING_COUNTRIES,
Params::REQUEST_VALUE_GROUPING_DAY,
]),
]);
print_r($data);
} catch (AdjustKPIServiceException $e) {
echo 'An error occurred: ' . PHP_EOL . $e->getMessage() . PHP_EOL;
}
You may need to edit path to autoload.php in the phpunit.xml, (*8)
bootstrap="./vendor/autoload.php"
cd path/to/adjust-api-sdk/tests && phpunit -v -c ../phpunit.xml . --coverage-text
PHP SDK for Adjust API
MIT
PHP SDK for Adjust API