PHP code example of tracker-my-com / mytracker-client-php

1. Go to this page and download the library: Download tracker-my-com/mytracker-client-php 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/ */

    

tracker-my-com / mytracker-client-php example snippets


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();