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 tag'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

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-metrika.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 200
    • filial_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

ID of the tag 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.

  • SAVE: All previously transmitted data is completely replaced with new data. Details.
  • UPDATE: Only the data that you're currently uploading is updated. Details.
  • APPEND: New data is added to previously uploaded data. Details.

Example: SAVE

delimiter_type

Type: string

Type of column separator used in the file:

  • COMMA: Comma separator.
  • SEMICOLON: Semicolon separator.

Default: COMMA

Example: ``

Body

multipart/form-data
{
  "file": "example"
}

Name

Description

file

Type: string<binary>

The file size limit is 1 GB.

Example: example

Responses

200 OK

OK

Body

application/json
{
  "uploading": {
    "uploading_id": "example",
    "datetime": "2020-04-21T11:59:21.000Z",
    "api_validation_status": "example",
    "elements_count": 0,
    "entity_type": "example",
    "uploading_format": "example",
    "uploading_source": "example"
  }
}

Name

Description

uploading

Type: UploadingMetaExternal

Upload information

Example
{
  "uploading_id": "example",
  "datetime": "2020-04-21T11:59:21.000Z",
  "api_validation_status": "example",
  "elements_count": 0,
  "entity_type": "example",
  "uploading_format": "example",
  "uploading_source": "example"
}

UploadingMetaExternal

Upload information

Name

Description

api_validation_status

Type: string

Upload validation status:

  • PASSED: Validation passed.
  • FAILED: Validation failed.

Example: example

datetime

Type: string

Upload time.

Example: 2020-04-21T11:59:21.000Z

elements_count

Type: integer

Number of elements within the upload.

entity_type

Type: string

Entity type:

  • SYSTEM: System entity, such as contacts or orders.
  • CUSTOM_LIST: Custom list.
  • SYSTEM_LIST: System list, such as products.

Example: example

uploading_format

Type: string

Upload format. Possible values:

  • JSON
  • CSV

Example: example

uploading_id

Type: string

Upload ID.

Example: example

uploading_source

Type: string

Upload source. Possible values: API

Example: example

Example
{
  "uploading_id": "example",
  "datetime": "2020-04-21T11:59:21.000Z",
  "api_validation_status": "example",
  "elements_count": 0,
  "entity_type": "example",
  "uploading_format": "example",
  "uploading_source": "example"
}