Uploading data about customers and orders (CSV)
This method helps you send information about orders and customers to Yandex Metricа in a CSV file without additional settings. To collect statistics, pass the order creation date and time in the tag's time zone (create_date_time), along with one of the customer parameters (ClientID, phone number, or email address). You can transmit orders in different statuses with revenue and cost price data.
The information sent is taken into account in End-to-end analytics reports. In addition, you can use the data for retargeting and optimizing conversions in Yandex Direct.
Learn more about the format of transmitted data
- Uploading data by ClientID. We recommend using this ID type, because it's more accurate in matching the uploaded data with information about site users in Yandex Metrica.
When sending order data, pass the value that corresponds to the state of the uploaded orders in the merge_mode
parameter. If not sure which status to pass when resending data, specify SAVE.
Request syntax
counterId
: ID of the tag that you want to upload orders for.
https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/data/simple_orders
? merge_mode=<update_type>
& [delimiter_type=<delimiter_type>]
merge_mode * | Data saving mode. For any value, pass all required fields, even ones that aren't modified. Acceptable values:
|
delimiter_type | Type of column separator used in the file. Default value: COMMA. Acceptable values:
|
merge_mode * | Data saving mode. For any value, pass all required fields, even ones that aren't modified. Acceptable values:
|
delimiter_type | Type of column separator used in the file. Default value: COMMA. Acceptable values:
|
* Required
In the request body
POST https://api-metrika.yandex.net/cdp/api/v1/counter/2215573/data/simple_orders?
merge_mode=SAVE&
columns_mapping=
"client_uniq_id":"Customer ID",
"order_status":"id123",
"create_date_time" : "2020-04-17 16:12:21",
"emails" : ["exampl1@example.com","example2@example.com"],
"phones" : ["88005553535", "83449932378"],
"revenue":"Amount"&
delimiter_type=COMMA
Content-Type: multipart/form-data; boundary=------------------------7zDUQOAIAE9hEWoV
Context-Length: TBD
--------------------------7zDUQOAIAE9hEWoV
Content-Disposition: form-data; name="file"; filename="data.csv"
Content-Type: text/csv
Customer ID,Status,Creation date,Amount
11,paid,2020-06-11 12:30:00,43089.54
42,paid,2019-10-11 09:10:00,109999
42,created,2020-12-24 12:30:00,1004.17
--------------------------7zDUQOAIAE9hEWoV--
Sample request
POST https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/data/simple_orders?merge_mode=SAVE
Response format
{
"uploading" : {
"uploading_id" : < string > ,
"datetime" : < local_date_time > ,
"api_validation_status" : < api_validation_status > ,
"elements_count" : < integer > ,
"entity_type" : < entity_type > ,
"entity_subtype" : < string > ,
"uploading_format" : < uploading_format > ,
"uploading_source" : < uploading_source >
}
}
Parameters | Description |
---|---|
uploading | Upload information |
uploading | |
uploading_id | Upload ID |
datetime | Upload time |
api_validation_status | Upload validation status Possible values:
|
elements_count | Number of elements in the upload |
entity_type | Entity type Possible values:
|
entity_subtype | Entity subtype |
uploading_format | Upload format Possible values:
|
uploading_source | Upload source Possible values:
|
Parameters | Description |
---|---|
uploading | Upload information |
uploading | |
uploading_id | Upload ID |
datetime | Upload time |
api_validation_status | Upload validation status Possible values:
|
elements_count | Number of elements in the upload |
entity_type | Entity type Possible values:
|
entity_subtype | Entity subtype |
uploading_format | Upload format Possible values:
|
uploading_source | Upload source Possible values:
|