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
Alert
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>]
|
A token for data uploading. You can get it in the Settings section of your application. |
|
Unique numeric identifier for the application in AppMetrica. |
|
User profile ID. The Post API allows you only to upload data for identifiers that were previously sent via the SDK. Alert Do not pass the value with the |
|
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. Alert Do not pass the value with the |
|
Time of the event in Unix time format. With the Post API, you can upload events only if the difference between the event date (event_timestamp) and the upload date is no more than seven days. The API expects a value in seconds. |
|
E-commerce event type. Possible values: SHOW_SCREEN, SHOW_PRODUCT_CARD, SHOW_PRODUCT_DETAILS, ADD_TO_CART, REMOVE_FROM_CART, BEGIN_CHECKOUT, PURCHASE. |
|
Order ID. |
|
Product name. |
|
The number of items in the cart. |
|
The price currency of the product in the cart. If omitted, the |
|
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 |
|
The internal currency type for the product in the cart. If omitted, the |
|
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 |
|
The currency of the actual product price. If omitted, the |
|
Actual product price. This is the current product price, including discounts. If omitted, the |
|
The internal currency of the actual product price. If omitted, the |
|
Actual product price in the internal currency. This is the current product price, including discounts. If omitted, the |
|
Arbitrary payload: Additional information presented as key-value pairs. The maximum size is 30 KB. If the value exceeds this limit, it will be truncated by AppMetrica. |
|
Level 1 product category. |
|
Level 2 product category. |
|
Level 3 product category. |
|
Level 4 product category. |
|
Level 5 product category. |
|
Level 6 product category. |
|
Level 7 product category. |
|
Level 8 product category. |
|
Level 9 product category. |
|
Level 10 product category. |
|
The currency of the initial product price. List of available currencies. |
|
Initial product price before any discounts. |
|
The internal currency of the initial product price. |
|
Initial product price in the internal currency. |
|
Arbitrary payload: Additional information presented as key-value pairs. The maximum size is 30 KB. If the value exceeds this limit, it will be truncated by AppMetrica. |
|
Array of applied promo codes. |
|
Product ID. |
|
Level 1 product category page. |
|
Level 2 product category page. |
|
Level 3 product category page. |
|
Level 4 product category page. |
|
Level 5 product category page. |
|
Level 6 product category page. |
|
Level 7 product category page. |
|
Level 8 product category page. |
|
Level 9 product category page. |
|
Level 10 product category page. |
|
The name of the page or screen viewed. |
|
Arbitrary payload: Additional information presented as key-value pairs. The maximum size is 30 KB. If the value exceeds this limit, it will be truncated by AppMetrica. |
|
The type of session. Possible values:
Default value is |
|
The device's IFA in the format received from the device. |
|
IFV for the app in the format received from the device. |
|
The device's Google AID in the format received from the device. |
|
The device's Windows AID in the format received from the device. |
|
Operating system on the user's device: |
|
The version of the operating system on the user's device. |
|
The device manufacturer detected by the AppMetrica service (for example, Apple or Samsung). |
|
The device model detected by the AppMetrica service (for example, Galaxy S6). |
|
The device type detected by the AppMetrica service. Possible values: |
|
The language on the device. |
|
The app version in the format specified by the developer. |
|
The package name for Android, or the Bundle ID for iOS (for example, ru.yandex.metro). |
|
Type of connection. Possible values: |
|
Name of the mobile operator. |
|
Mobile country code. |
|
Mobile network code. |
|
The IP address at the time of the event in IPv6 format. For example, 2a02:6b8::40c:6676:baff:fea6:53d8, ::ffff:5.255.232.147. |
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. |
Sample request
POST /logs/v1/import/ecommerce.csv?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012 HTTP/1.1
Host: api.appmetrica.yandex.ru
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.ru
Content-Length: 0
Connection: close
Other Post API methods
If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.