Uploading simplified data about customers and orders (CSV)
Using the simplified method, you can send order and customer data to Yandex Metrica in a CSV file without additional settings (order status mapping, uploading separate lists of customers and orders, or uploading a product list and additional attributes). To collect statistics, pass the order creation date and time in the counter's time zone (create_date_time
) and one of the customer parameters (ClientID, phone number, email address, or a hashed 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
Note
The file size limit is 1 GB.
Examples of an uploaded file
- Upload 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.
- Upload data by email addresses.
- Upload data by phone numbers.
- Upload different IDs in a single file.
When sending order data, pass the value that corresponds to the state of the uploaded orders within the merge_mode
parameter. If you're not sure which status to pass when resending data, specify SAVE
.
Sample request
POST https://api-metrica.yandex.net/cdp/api/v1/counter/2215573/data/simple_orders?merge_mode=SAVE&delimiter_type=COMMA
Content-Disposition: form-data; name="file"; filename="data.csv"
Content-Type: multipart/form-data; boundary=------------------------7zDUQOAIAE9hEWoV
Context-Length: TBD
--------------------------7zDUQOAIAE9hEWoV
Content-Disposition: form-data; name="file"; filename="data.csv"
Content-Type: text/csv
id,create_date_time,client_uniq_id,client_ids,emails,phones,order_status,revenue,cost,goals,currency
s_ord1,10.01.2024 11:56,s_user1,,"mail@example.com,mail2@example.com",,PAID,200,150,"oplata_cash:200,filial_1",
s_ord2,20.01.2024 11:59,,12345,mail3@example.com,,,200,150,,EUR
,12.02.2024,,34456,,79876543210,SPAM,,,plohoy_lead,
--------------------------7zDUQOAIAE9hEWoV--
Here's an example of how data is sent
Three orders are sent in this example:
Order with the ID s_ord1
- Order date: 10.01.2024 11:56
- Customer ID from the CRM:
s_user1
- Customer emails: mail@example.com, mail2@example.com
- ClientID and phone numbers: Missing
- Order status:
PAID
(completes the goals CRM: Order created and CRM: Order paid) - Revenue: 200
- Cost: 150 (goal revenue is set to 50)
- In addition, the following JavaScript goals are transmitted:
oplata_cash
with revenue set to 200filial_1
with no revenue (the goal revenue from the main order columns is used: 200-150=50)
- Currency: Not specified (all revenue values are in rubles)
Order with the ID s_ord2
- Order date: 20.01.2024 11:59
- Customer ID from the CRM: Not transmitted
- Customer email: mail3@example.com
- ClientID: 12345
- Phone numbers: Missing
- Order status: Not transmitted (transmits
PAID
by default; completes the goals CRM: Order created and CRM: Order paid) - Revenue: 200
- Cost: 150 (goal revenue is set to 50)
- Additional goals: None
- Currency: EUR (all revenue values are in euros)
Order with no ID
- Order date: 12.02.2024 (without specifying the hour and minute — Yandex Metrica searches for past sessions to associate with the order starting from 12.02.2024 23:59)
- Customer ID from the CRM: Not transmitted
- Customer email: mail3@example.com
- ClientID: 34456
- Phone number: 79876543210
- Order status:
SPAM
(doesn't complete any goals) - Revenue and cost: Not specified
- In addition, the following JavaScript goal is transmitted:
bad_lead
: Achieved with no revenue
- Currency: Not specified
Request
POST
https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/data/simple_orders
Path parameters
Name |
Description |
counterId* |
Type: integer<int32> ID of the counter for which you want to upload orders. |
Query parameters
Name |
Description |
merge_mode* |
Type: string Data saving mode. For any value, pass all required fields, even ones that aren't modified. |
delimiter_type |
Type: string Type of column separator used in the file.
Default: |
Body
multipart/form-data
{
"file": null
}
Name |
Description |
file* |
Type: string<binary> The file size limit is 1 GB. |
Responses
200 OK
OK
Body
application/json
{
"uploading": {
"uploading_id": "string",
"datetime": "2022-12-29T18:02:01Z",
"api_validation_status": "string",
"elements_count": 0,
"entity_type": "string",
"uploading_format": "string",
"uploading_source": "string"
}
}
Name |
Description |
uploading |
Type: UploadingMetaExternal Description of the |
UploadingMetaExternal
Description of the UploadingMetaExternal
object.
Name |
Description |
api_validation_status |
Type: string Upload validation status:
|
datetime |
Type: string<date-time> Upload time. |
elements_count |
Type: integer<int32> Number of elements within the upload. |
entity_type |
Type: string Entity type:
|
uploading_format |
Type: string Upload format. Possible values:
|
uploading_id |
Type: string Upload ID. |
uploading_source |
Type: string Upload source. Possible values: |
No longer supported, please use an alternative and newer version.