tracker-my-com/mytracker-client-php

A PHP library to interact with API of tracker.my.com

1.1.0 2023-11-02 23:33 UTC

This package is auto-updated.

Last update: 2024-05-03 10:52:43 UTC


README

  • Thin & minimal HTTP client to interact with MyTracker's API
  • Supports php ^8.0.
  • Adheres to PSR-18, PSR-17 and PSR-7 principles under the hood.

💡 Getting Started

First, install MyTracker PHP API Client via the composer package manager:

composer require tracker-my-com/mytracker-client-php

Then, use \MyTracker\ExportApi\*Client classes in your code:

use Http\Discovery\Psr18Client;
use MyTracker\ExportApi\QuotasClient;
use MyTracker\ExportApi\RawDataClient;

$psr18Client = new Psr18Client();

$quotasClient = new QuotasClient('appUserId', 'apiSecretKey', $psr18Client);
$result = $quotasClient->get();
echo $result->getBody();

$rawDataClient = new RawDataClient('appUserId', 'apiSecretKey', $psr18Client);
$result = $rawDataClient->create([
    'event' => 'payments',
    'selectors' => 'idCountry,waid,idAccount,iosVendorId',
    'dateTo' => '2017-11-30',
    'dateFrom' => '2017-11-02',
    'timezone' => 'Europe/Moscow',
]);
echo $result->getBody();

$result = $rawDataClient->get(123 /* idRawExport from the previous request */);
echo $result->getBody();

$reportClient = new ReportClient('appUserId', 'apiSecretKey', $psr18Client);
$result = $reportClient->create([
    'settings' => [
        'filter' => [
            'date' => [
                'from' => '2020-07-10',
                'to' => '2020-07-17',
            ],
        ],
        'selectors' => 'idApp,countInstall',
        'idCurrency' => 643,
        'tz' => 'Europe/Moscow',
        'precision' => 2,
        'retIndent' => 3600,
    ]
]);

$result = $reportClient->get(123 /* idReportFile from the previous request */);
echo $result->getBody();

For full documentation, visit the MyTracker Export API docs.

❓ Troubleshooting

Encountering an issue? Contact us!

📄 License

MyTracker PHP API Client is an open-sourced software licensed under the MIT license.