All URIs are relative to https://api.criteo.com/marketing
Method | HTTP request | Description |
---|---|---|
getCampaignReport | POST /v1/statistics/report | Generates a statistics report |
getStats | POST /v1/statistics | Generates a statistics report |
string getCampaignReport($authorization, $report_query)
Generates a statistics report
###This Statistics endpoint is an upgrade of our previous Statistics endpoint, and includes new metrics and customization capabilities. It is currently in beta and subject to change. Reach out to your Criteo contact if you’re interesting in participating in the beta### AdvertiserIds:(mandatory) The list of advertiser ids, comma-separated. Advertisers not in your portfolio will be skipped. If no id is present, all the advertisers in the portfolio will be used.
StartDate, EndDate: (mandatory) Start date (beginning of day) and end date (beginning of day) to be used for the report generation. Format to use: yyyy-mm-dd (e.g. 2017-10-30).
Dimensions: (mandatory) The dimensions to be used in the report. Possible values: CampaignId, Campaign, AdvertiserId, Advertiser, CategoryId, Category, Hour, Day, Week, Month, Year.
Metrics:(mandatory) The metrics to be used in the report. For a list of possible values, please see <a href="https://support.criteo.com/s/article?article=API-Statistics-Reference\">the full documentation.
Format: (mandatory)The file format of the generated report. Possible values: Csv, Excel, Xml, Json
Currency: (optional) The currency to be used in the report. ISO 4217 code (three-letter capitals). For a list of supported values, please see <a href="https://support.criteo.com/s/article?article=Supported-currencies-API\">the full documentation. If not set, the user's preference setting will be used.
Timezone: (optional) Timezone to be used in the report. Possible format
- TZ format (e.g. Europe/London) - UTC format (e.g. UTC+1:00) - Timezone abbreviation (e.g. PST) If not set, GMT is used.
#### Functional cases #### Statistic export in a file might be corrupted through Swagger. It's recommended to access this file through a CURL request or other programmatic methods. #### Validation rules #### StartDate and EndDate are mandatory.
StartDate should come before, or be equal to EndDate.
The requested dimensions must be in a supported combination.
At least one metric must be provided.
All metrics must be supported.
No duplicated metric in the list.
The selected advertisers must have at least one campaign.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: Authorization
$config = Criteo\Marketing\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Criteo\Marketing\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Criteo\Marketing\Api\StatisticsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$authorization = 'Bearer VALID_JWT_TOKEN_BASE64'; // string | JWT Bearer Token
$report_query = new \Criteo\Marketing\Model\CampaignReportQueryMessage(); // \Criteo\Marketing\Model\CampaignReportQueryMessage |
try {
$result = $apiInstance->getCampaignReport($authorization, $report_query);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StatisticsApi->getCampaignReport: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
authorization | string | JWT Bearer Token | [default to 'Bearer VALID_JWT_TOKEN_BASE64'] |
report_query | \Criteo\Marketing\Model\CampaignReportQueryMessage |
string
- Content-Type: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded, text/html
- Accept: application/json, text/json, application/xml, text/xml, text/html
[Back to top] [Back to API list] [Back to Model list] [Back to README]
string getStats($authorization, $stats_query)
Generates a statistics report
ReportType: The type of report to generate. Possible values: CampaignPerformance, FacebookDPA, TransactionID. (mandatory)
AdvertiserIds: The list of advertiser ids, comma-separated. Advertisers not in your portfolio will be skipped. If not present, all the advertisers in the portfolio will be used. (optional)
StartDate, EndDate: Start date (beginning of day) and end date (end of day) to be used for the report generation. Format to use: yyyy-MM-dd (e.g. 2017-10-30). (mandatory)
Dimensions: The dimensions to be used in the report. Between one and three. Possible values: CampaignId, AdvertiserId, Category, Hour, Day, Week, Month, Year. (mandatory)
Metrics: The metrics to be used in the report. For a list of possible values, please see <a href="https://support.criteo.com/s/article?article=Criteo-Marketing-API-Intro\">the full documentation. (mandatory)
Format: The file format of the generated report. Possible values: Csv, Excel, Xml, Json (mandatory)
Currency: The currency to be used in the report. Three-letter capitals. For a list of possible values, please see <a href="https://support.criteo.com/s/article?article=Criteo-Marketing-API-Intro\">the full documentation. If not set, the user's preference setting will be used. (optional)
Timezone: Timezone to be used in the report. Possible values: GMT, PST, JST. If not set, the user's preference setting will be used. (optional)
IgnoreXDevice: Ignore cross-device data. Also can explicitly set to null for TransactionID ReportType to get all data. Defaults to false. (optional)
StartDate should come before, or be equal to EndDate.
The requested dimensions must be in a supported combination.
At least one metric must be provided.
All metrics must be supported.
The selected advertisers must have at least one campaign.
Seller dimension is not supported.
If you are asking for a CampaignPerformance report and sales metrics are late, response will have a custom header latest-available-sales, a datetime with format yyyy-MM-dd HH:mm using the requested timezone.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: Authorization
$config = Criteo\Marketing\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Criteo\Marketing\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Criteo\Marketing\Api\StatisticsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$authorization = 'Bearer VALID_JWT_TOKEN_BASE64'; // string | JWT Bearer Token
$stats_query = new \Criteo\Marketing\Model\StatsQueryMessageEx(); // \Criteo\Marketing\Model\StatsQueryMessageEx | The report query details
try {
$result = $apiInstance->getStats($authorization, $stats_query);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StatisticsApi->getStats: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
authorization | string | JWT Bearer Token | [default to 'Bearer VALID_JWT_TOKEN_BASE64'] |
stats_query | \Criteo\Marketing\Model\StatsQueryMessageEx | The report query details |
string
- Content-Type: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded, text/html
- Accept: application/json, text/json, application/xml, text/xml, text/html
[Back to top] [Back to API list] [Back to Model list] [Back to README]