Uploading E-commerce events

Transmits data about E-commerce events.

Usage example: You can transmit all E-commerce events via the Post API to collect data about user purchases in one place, including those made in the app, offline store, or on a website.

Event properties can be passed in parameters or in the body of the request. When you pass data in the body, you should add .csv to the URL of the request. For more information, see Sample request.

To bind an event to a user, you should use one of the following fields in the API request:

  • profile_id
  • appmetrica_device_id
Attention. The Post API has restrictions on loading data. For more information, see Restrictions.

Request format

POST https://api.appmetrica.yandex.ru/logs/v1/import/ecommerce
 ? post_api_key=<string>
 & application_id=<int>
 & profile_id=<string>
 & appmetrica_device_id=<int>
 & event_timestamp=<int>
 & ecom_event_type=<string>
 & order_id=<string>
 & product_name=<string>
 & cart_item_quantity=<int>
 & [cart_item_price_currency=<string>]
 & [cart_item_price_value=<int>]
 & [cart_item_price_internal_currency=<array>]
 & [cart_item_price_internal_value=<array>]
 & [actual_price_currency=<string>]
 & [actual_price_value=<int>]
 & [actual_price_internal_currency=<array>]
 & [actual_price_internal_value=<array>]
 & [payload=<string>]
 & [product_category_path_1=<string>]
 & [product_category_path_2=<string>]
 & [product_category_path_3=<string>]
 & [product_category_path_4=<string>]
 & [product_category_path_5=<string>]
 & [product_category_path_6=<string>]
 & [product_category_path_7=<string>]
 & [product_category_path_8=<string>]
 & [product_category_path_9=<string>]
 & [product_category_path_10=<string>]
 & original_price_currency=<string>
 & original_price_value=<int>
 & [original_price_internal_currency=<array>]
 & [original_price_internal_value=<array>]
 & [product_payload=<string>]
 & [product_promo_codes=<array>]
 & [product_sku=<string>]
 & [screen_category_path_1=<string>]
 & [screen_category_path_2=<string>]
 & [screen_category_path_3=<string>]
 & [screen_category_path_4=<string>]
 & [screen_category_path_5=<string>]
 & [screen_category_path_6=<string>]
 & [screen_category_path_7=<string>]
 & [screen_category_path_8=<string>]
 & [screen_category_path_9=<string>]
 & [screen_category_path_10=<string>]
 & [screen_name=<string>]
 & [screen_payload=<string>]
 & [session_type=<string>]
 & [ios_ifa=<string>]
 & [ios_ifv=<string>]
 & [google_aid=<string>]
 & [windows_aid=<string>]
 & [os_name=<string>]
 & [os_version=<string>]
 & [device_manufacturer=<string>]
 & [device_model=<string>]
 & [device_type=<string>]
 & [device_locale=<string>]
 & [app_version_name=<string>]
 & [app_package_name=<string>]
 & [connection_type=<string>]
 & [operator_name=<string>]
 & [mcc=<int>]
 & [mnc=<int>]
 & [device_ipv6=<string>]
post_api_key *Token for data uploading. You can get it in the Settings section of your application.
application_id *Unique numeric identifier for the application in AppMetrica.
profile_id *User profile ID. The Post API allows you only to upload data for identifiers that were previously sent via the SDK.
Attention. Do not pass the value with the appmetrica_device_id parameter. The server accepts only one of these parameters.
appmetrica_device_id *Hash from the unique identifier of the device set by AppMetrica. The Post API allows you only to upload data for identifiers that were previously sent via the SDK.
Attention. Do not pass the value with the profile_id parameter. The server accepts only one of these parameters.
event_timestamp *Time of the event in the UNIX timestamp format.

You can upload events only if the difference between the event date (event_timestamp) and the upload date is no more than seven days.

ecom_event_type *E-commerce event type. Possible values: SHOW_SCREEN, SHOW_PRODUCT_CARD, SHOW_PRODUCT_DETAILS, ADD_TO_CART, REMOVE_FROM_CART, BEGIN_CHECKOUT, and PURCHASE.
order_id *Unique order ID.
product_name *Product name.
cart_item_quantity *The number of items in the cart.
cart_item_price_currencyThe price currency of the product in the cart. If omitted, the actual_price_currency value is used. List of available currencies.
cart_item_price_valueThe price of the product in the cart. This is the final price, including all promotions, promo codes, bonus points, and other discounts that the user applied. If omitted, the actual_price_value value is used.
cart_item_price_internal_currencyThe internal currency type for the product in the cart. If omitted, the actual_price_internal_currency value is used.
cart_item_price_internal_valueThe price of the product in the cart specified in the internal currency. This is the final price, including all promotions, promo codes, bonus points, and other discounts that the user applied. If omitted, the actual_price_internal_value value is used.
actual_price_currencyThe currency of the actual product price. If omitted, the original_price_currency value is used. List of available currencies.
actual_price_valueActual product price. This is the current product price, including discounts. If omitted, the original_price_value value is used.
actual_price_internal_currencyThe internal currency of the actual product price. If omitted, the original_price_internal_currency value is used.
actual_price_internal_valueActual product price in the internal currency. This is the current product price, including discounts. If omitted, the original_price_internal_value value is used.
payloadArbitrary payload: Additional information about the order presented as key-value pairs. The maximum size is 30 KB. If the value exceeds this limit, it will be truncated by AppMetrica.
product_category_path_1Level 1 product category.
product_category_path_2Level 2 product category.
product_category_path_3Level 3 product category.
product_category_path_4Level 4 product category.
product_category_path_5Level 5 product category.
product_category_path_6Level 6 product category.
product_category_path_7Level 7 product category.
product_category_path_8Level 8 product category.
product_category_path_9Level 9 product category.
product_category_path_10Level 10 product category.
original_price_currency *The currency of the initial product price. List of available currencies.
original_price_value *Initial product price without discounts.
original_price_internal_currencyThe internal currency of the initial product price.
original_price_internal_valueInitial product price in the internal currency.
product_payloadArbitrary payload: Additional information about a particular product presented as key-value pairs. The maximum size is 30 KB. If the value exceeds this limit, it will be truncated by AppMetrica.
product_promo_codesArray of applied promo codes.
product_skuProduct ID.
screen_category_path_1Level 1 product category page.
screen_category_path_2Level 2 product category page.
screen_category_path_3Level 3 product category page.
screen_category_path_4Level 4 product category page.
screen_category_path_5Level 5 product category page.
screen_category_path_6Level 6 product category page.
screen_category_path_7Level 7 product category page.
screen_category_path_8Level 8 product category page.
screen_category_path_9Level 9 product category page.
screen_category_path_10Level 10 product category page.
screen_nameThe name of the page or screen viewed.
screen_payloadArbitrary payload: Additional information about the page, such as a separate category, presented as key-value pairs. The maximum size is 30 KB. If the value exceeds this limit, it will be truncated by AppMetrica.
session_typeThe type of session. Possible values:
  • foreground — In the Events report AppMetrica increases the Users metric.
  • background — In the Events report AppMetrica increases the Devices metric. Such events are not included to the report with grouping by users, and into the profile card.

Default value is background.

ios_ifaDevice IFA.
ios_ifvDevice IFV.
google_aidGoogle AID.
windows_aidWindows AID.
os_nameThe name of the OS on the user's device. Possible values: ios | android | windows.
os_versionThe version of the operating system on the user's device.
device_manufacturerDevice manufacturer. For example, Apple, Samsung.
device_modelName of the device model For example, Galaxy S6, iPhone X.
device_typeThe device type detected by the AppMetrica service. Possible values: phone | tablet | phablet | tv | desktop | unknown.
device_localeThe language on the device. For example, en_US
app_version_nameThe app version in the format specified by the developer.
app_package_nameThe package name for Android, or the Bundle ID for iOS. For example, ru.yandex.sample.metrica.
connection_typeType of connection. Possible values: wifi | cell | unknown.
operator_nameName of the mobile operator. For example, MegaFon.
mccMobile country code. For example, 250
mncMobile network code. For example, 2
device_ipv6The IP address at the time of event, in the IPv6 format. For example, 2a02:6b8:: 40c:6676:baff:fea6:53d8, :: ffff:5.255.232.147
post_api_key *Token for data uploading. You can get it in the Settings section of your application.
application_id *Unique numeric identifier for the application in AppMetrica.
profile_id *User profile ID. The Post API allows you only to upload data for identifiers that were previously sent via the SDK.
Attention. Do not pass the value with the appmetrica_device_id parameter. The server accepts only one of these parameters.
appmetrica_device_id *Hash from the unique identifier of the device set by AppMetrica. The Post API allows you only to upload data for identifiers that were previously sent via the SDK.
Attention. Do not pass the value with the profile_id parameter. The server accepts only one of these parameters.
event_timestamp *Time of the event in the UNIX timestamp format.

You can upload events only if the difference between the event date (event_timestamp) and the upload date is no more than seven days.

ecom_event_type *E-commerce event type. Possible values: SHOW_SCREEN, SHOW_PRODUCT_CARD, SHOW_PRODUCT_DETAILS, ADD_TO_CART, REMOVE_FROM_CART, BEGIN_CHECKOUT, and PURCHASE.
order_id *Unique order ID.
product_name *Product name.
cart_item_quantity *The number of items in the cart.
cart_item_price_currencyThe price currency of the product in the cart. If omitted, the actual_price_currency value is used. List of available currencies.
cart_item_price_valueThe price of the product in the cart. This is the final price, including all promotions, promo codes, bonus points, and other discounts that the user applied. If omitted, the actual_price_value value is used.
cart_item_price_internal_currencyThe internal currency type for the product in the cart. If omitted, the actual_price_internal_currency value is used.
cart_item_price_internal_valueThe price of the product in the cart specified in the internal currency. This is the final price, including all promotions, promo codes, bonus points, and other discounts that the user applied. If omitted, the actual_price_internal_value value is used.
actual_price_currencyThe currency of the actual product price. If omitted, the original_price_currency value is used. List of available currencies.
actual_price_valueActual product price. This is the current product price, including discounts. If omitted, the original_price_value value is used.
actual_price_internal_currencyThe internal currency of the actual product price. If omitted, the original_price_internal_currency value is used.
actual_price_internal_valueActual product price in the internal currency. This is the current product price, including discounts. If omitted, the original_price_internal_value value is used.
payloadArbitrary payload: Additional information about the order presented as key-value pairs. The maximum size is 30 KB. If the value exceeds this limit, it will be truncated by AppMetrica.
product_category_path_1Level 1 product category.
product_category_path_2Level 2 product category.
product_category_path_3Level 3 product category.
product_category_path_4Level 4 product category.
product_category_path_5Level 5 product category.
product_category_path_6Level 6 product category.
product_category_path_7Level 7 product category.
product_category_path_8Level 8 product category.
product_category_path_9Level 9 product category.
product_category_path_10Level 10 product category.
original_price_currency *The currency of the initial product price. List of available currencies.
original_price_value *Initial product price without discounts.
original_price_internal_currencyThe internal currency of the initial product price.
original_price_internal_valueInitial product price in the internal currency.
product_payloadArbitrary payload: Additional information about a particular product presented as key-value pairs. The maximum size is 30 KB. If the value exceeds this limit, it will be truncated by AppMetrica.
product_promo_codesArray of applied promo codes.
product_skuProduct ID.
screen_category_path_1Level 1 product category page.
screen_category_path_2Level 2 product category page.
screen_category_path_3Level 3 product category page.
screen_category_path_4Level 4 product category page.
screen_category_path_5Level 5 product category page.
screen_category_path_6Level 6 product category page.
screen_category_path_7Level 7 product category page.
screen_category_path_8Level 8 product category page.
screen_category_path_9Level 9 product category page.
screen_category_path_10Level 10 product category page.
screen_nameThe name of the page or screen viewed.
screen_payloadArbitrary payload: Additional information about the page, such as a separate category, presented as key-value pairs. The maximum size is 30 KB. If the value exceeds this limit, it will be truncated by AppMetrica.
session_typeThe type of session. Possible values:
  • foreground — In the Events report AppMetrica increases the Users metric.
  • background — In the Events report AppMetrica increases the Devices metric. Such events are not included to the report with grouping by users, and into the profile card.

Default value is background.

ios_ifaDevice IFA.
ios_ifvDevice IFV.
google_aidGoogle AID.
windows_aidWindows AID.
os_nameThe name of the OS on the user's device. Possible values: ios | android | windows.
os_versionThe version of the operating system on the user's device.
device_manufacturerDevice manufacturer. For example, Apple, Samsung.
device_modelName of the device model For example, Galaxy S6, iPhone X.
device_typeThe device type detected by the AppMetrica service. Possible values: phone | tablet | phablet | tv | desktop | unknown.
device_localeThe language on the device. For example, en_US
app_version_nameThe app version in the format specified by the developer.
app_package_nameThe package name for Android, or the Bundle ID for iOS. For example, ru.yandex.sample.metrica.
connection_typeType of connection. Possible values: wifi | cell | unknown.
operator_nameName of the mobile operator. For example, MegaFon.
mccMobile country code. For example, 250
mncMobile network code. For example, 2
device_ipv6The IP address at the time of event, in the IPv6 format. For example, 2a02:6b8:: 40c:6676:baff:fea6:53d8, :: ffff:5.255.232.147

* Required

Response codes

Code Description
200 Data has been uploaded successfully.
403 The request omitted an authorization header, or an invalid token was specified.
400 One or more required parameters were missing in the request.
Code Description
200 Data has been uploaded successfully.
403 The request omitted an authorization header, or an invalid token was specified.
400 One or more required parameters were missing in the request.

Sample request

POST /logs/v1/import/ecommerce.csv?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012 HTTP/1.1
Host: api.appmetrica.yandex.com
Content-Length: 540i
Connection: close

application_id,profile_id,appmetrica_device_id,event_timestamp,ecom_event_type,order_id,product_name,cart_item_quantity,cart_item_price_currency,cart_item_price_value,cart_item_price_internal_currency
cart_item_price_internal_value,actual_price_currency,actual_price_value,actual_price_internal_currency,actual_price_internal_value,payload,product_category_path_1,product_category_path_2,product_category_path_3,product_category_path_4,product_category_path_5,product_category_path_6,product_category_path_7,product_category_path_8,product_category_path_9,product_category_path_10,original_price_currency,original_price_value,original_price_internal_currency,original_price_internal_value,product_payload,product_promo_codes,product_sku,screen_category_path_1,screen_category_path_2,screen_category_path_3,screen_category_path_4,screen_category_path_5,screen_category_path_6,screen_category_path_7,screen_category_path_8,screen_category_path_9,screen_category_path_10,screen_name,screen_payload,session_type,ios_ifa,ios_ifv,google_aid,windows_aid,os_name,os_version,device_manufacturer,device_model,device_type,device_locale,app_version_name,app_package_name,connection_type,operator_name,mcc,mnc,device_ipv6
1234567890,1234567890abcdef,1234567890abcdef,1757762239877245682,1689943892,ADD_TO_CART,a1b2c3d4,some_product,1,usd,0.5,some_currency,1.43,usd,0.7,some_currency,2,"{""key"":""value_1""}",product_path_1,product_path_2,product_path_3,product_path_4,product_path_5,product_path_6,product_path_7,product_path_8,product_path_9,product_path_10,usd,1.05,some_currency,3,"{""key"":""value_1""}","[promo_code_1,promo_code_2]",012345abc,screen_path_1,screen_path_2,screen_path_3,screen_path_4,screen_path_5,screen_path_6,screen_path_7,screen_path_8,screen_path_9,screen_path_10,some_screen,"{""key"":""value_1""}",foreground,123456abcde,567890abcde,ios,16.6,Apple,iPhone14Pro,phone,en_US,some_version_name,some_package_name,wifi,MegaFon,250,2,2a02:6b8::40c:6676:baff:fea6:53d8

Other Post API methods