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
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 ( |
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_currency | The price currency of the product in the cart. If omitted, the actual_price_currency value is used. List of available currencies. |
cart_item_price_value | The 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_currency | The internal currency type for the product in the cart. If omitted, the actual_price_internal_currency value is used. |
cart_item_price_internal_value | The 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_currency | The currency of the actual product price. If omitted, the original_price_currency value is used. List of available currencies. |
actual_price_value | Actual product price. This is the current product price, including discounts. If omitted, the original_price_value value is used. |
actual_price_internal_currency | The internal currency of the actual product price. If omitted, the original_price_internal_currency value is used. |
actual_price_internal_value | Actual product price in the internal currency. This is the current product price, including discounts. If omitted, the original_price_internal_value value is used. |
payload | Arbitrary 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_1 | Level 1 product category. |
product_category_path_2 | Level 2 product category. |
product_category_path_3 | Level 3 product category. |
product_category_path_4 | Level 4 product category. |
product_category_path_5 | Level 5 product category. |
product_category_path_6 | Level 6 product category. |
product_category_path_7 | Level 7 product category. |
product_category_path_8 | Level 8 product category. |
product_category_path_9 | Level 9 product category. |
product_category_path_10 | Level 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_currency | The internal currency of the initial product price. |
original_price_internal_value | Initial product price in the internal currency. |
product_payload | Arbitrary 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_codes | Array of applied promo codes. |
product_sku | Product ID. |
screen_category_path_1 | Level 1 product category page. |
screen_category_path_2 | Level 2 product category page. |
screen_category_path_3 | Level 3 product category page. |
screen_category_path_4 | Level 4 product category page. |
screen_category_path_5 | Level 5 product category page. |
screen_category_path_6 | Level 6 product category page. |
screen_category_path_7 | Level 7 product category page. |
screen_category_path_8 | Level 8 product category page. |
screen_category_path_9 | Level 9 product category page. |
screen_category_path_10 | Level 10 product category page. |
screen_name | The name of the page or screen viewed. |
screen_payload | Arbitrary 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_type | The type of session. Possible values:
Default value is |
ios_ifa | Device IFA. |
ios_ifv | Device IFV. |
google_aid | Google AID. |
windows_aid | Windows AID. |
os_name | The name of the OS on the user's device. Possible values: ios | android | windows . |
os_version | The version of the operating system on the user's device. |
device_manufacturer | Device manufacturer. For example, Apple, Samsung. |
device_model | Name of the device model For example, Galaxy S6, iPhone X. |
device_type | The device type detected by the AppMetrica service. Possible values: phone | tablet | phablet | tv | desktop | unknown . |
device_locale | The language on the device. For example, en_US |
app_version_name | The app version in the format specified by the developer. |
app_package_name | The package name for Android, or the Bundle ID for iOS. For example, ru.yandex.sample.metrica . |
connection_type | Type of connection. Possible values: wifi | cell | unknown . |
operator_name | Name of the mobile operator. For example, MegaFon. |
mcc | Mobile country code. For example, 250 |
mnc | Mobile network code. For example, 2 |
device_ipv6 | The 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 ( |
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_currency | The price currency of the product in the cart. If omitted, the actual_price_currency value is used. List of available currencies. |
cart_item_price_value | The 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_currency | The internal currency type for the product in the cart. If omitted, the actual_price_internal_currency value is used. |
cart_item_price_internal_value | The 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_currency | The currency of the actual product price. If omitted, the original_price_currency value is used. List of available currencies. |
actual_price_value | Actual product price. This is the current product price, including discounts. If omitted, the original_price_value value is used. |
actual_price_internal_currency | The internal currency of the actual product price. If omitted, the original_price_internal_currency value is used. |
actual_price_internal_value | Actual product price in the internal currency. This is the current product price, including discounts. If omitted, the original_price_internal_value value is used. |
payload | Arbitrary 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_1 | Level 1 product category. |
product_category_path_2 | Level 2 product category. |
product_category_path_3 | Level 3 product category. |
product_category_path_4 | Level 4 product category. |
product_category_path_5 | Level 5 product category. |
product_category_path_6 | Level 6 product category. |
product_category_path_7 | Level 7 product category. |
product_category_path_8 | Level 8 product category. |
product_category_path_9 | Level 9 product category. |
product_category_path_10 | Level 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_currency | The internal currency of the initial product price. |
original_price_internal_value | Initial product price in the internal currency. |
product_payload | Arbitrary 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_codes | Array of applied promo codes. |
product_sku | Product ID. |
screen_category_path_1 | Level 1 product category page. |
screen_category_path_2 | Level 2 product category page. |
screen_category_path_3 | Level 3 product category page. |
screen_category_path_4 | Level 4 product category page. |
screen_category_path_5 | Level 5 product category page. |
screen_category_path_6 | Level 6 product category page. |
screen_category_path_7 | Level 7 product category page. |
screen_category_path_8 | Level 8 product category page. |
screen_category_path_9 | Level 9 product category page. |
screen_category_path_10 | Level 10 product category page. |
screen_name | The name of the page or screen viewed. |
screen_payload | Arbitrary 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_type | The type of session. Possible values:
Default value is |
ios_ifa | Device IFA. |
ios_ifv | Device IFV. |
google_aid | Google AID. |
windows_aid | Windows AID. |
os_name | The name of the OS on the user's device. Possible values: ios | android | windows . |
os_version | The version of the operating system on the user's device. |
device_manufacturer | Device manufacturer. For example, Apple, Samsung. |
device_model | Name of the device model For example, Galaxy S6, iPhone X. |
device_type | The device type detected by the AppMetrica service. Possible values: phone | tablet | phablet | tv | desktop | unknown . |
device_locale | The language on the device. For example, en_US |
app_version_name | The app version in the format specified by the developer. |
app_package_name | The package name for Android, or the Bundle ID for iOS. For example, ru.yandex.sample.metrica . |
connection_type | Type of connection. Possible values: wifi | cell | unknown . |
operator_name | Name of the mobile operator. For example, MegaFon. |
mcc | Mobile country code. For example, 250 |
mnc | Mobile network code. For example, 2 |
device_ipv6 | The 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
POST /logs/v1/import/ecommerce.csv?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012&application_id=1234567890&profile_id=1234567890abcdef&appmetrica_device_id=1757762239877245682&event_timestamp=1689943892&ecom_event_type=ADD_TO_CART&order_id=a1b2c3d4&product_name=some_product&cart_item_quantity=1&cart_item_price_currency=usd&cart_item_price_value=0.5&cart_item_price_internal_currency=some_currency&cart_item_price_internal_value=1.43&actual_price_currency=usd&actual_price_value=0.7&actual_price_internal_currency=some_currency&actual_price_internal_value=2&payload="{""key"":""value_1""}"&product_category_path_1=product_path_1&product_category_path_2=product_path_2&product_category_path_3=product_path_3&product_category_path_4=product_path_4&product_category_path_5=product_path_5&product_category_path_6=product_path_6&product_category_path_7=product_path_7&product_category_path_8=product_path_8&product_category_path_9=product_path_9&product_category_path_10=product_path_10&original_price_currency=usd&original_price_value=1.05&original_price_internal_currency=some_currency&original_price_internal_value=3&product_payload="{""key"":""value_1""}"&product_promo_codes="[promo_code_1,promo_code_2]"&product_sku=012345abc&screen_category_path_1=screen_path_1&screen_category_path_2=screen_path_2&screen_category_path_3=screen_path_3&screen_category_path_4=screen_path_4&screen_category_path_5=screen_path_5&screen_category_path_6=screen_path_6&screen_category_path_7=screen_path_7&screen_category_path_8=screen_path_8&screen_category_path_9=screen_path_9&screen_category_path_10=screen_path_10&screen_name=some_screen&screen_payload="{""key"":""value_1""}"&session_type=foreground&ios_ifa=123456abcde&ios_ifv=54321edcba&google_aid=098765abcde&windows_aid=567890abcde&os_name=ios&os_version=16.6&device_manufacturer=Apple&device_model=iPhone14Pro&device_type=phone&device_locale=en_US&app_version_name=some_version_name&app_package_name=some_package_name&connection_type=wifi&operator_name=MegaFon&mcc=250&mnc=2&device_ipv6=2a02:6b8::40c:6676:baff:fea6:53d8 HTTP/1.1
Host: api.appmetrica.yandex.com
Content-Length: 0
Connection: close