Uploading offer events

Transmits data about offer events (Product Flow).

Usage example: You can send server-side (S2S) results of product scenarios via the Post API. For example, the final decision from a bank or insurance company after a pending status in the app.

For scenario examples, see Product flow examples.

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.com/logs/v1/import/product_flow
  ? post_api_key=<string>
  & application_id=<int>
  & profile_id=<string>
  & appmetrica_device_id=<int>
  & event_timestamp=<int>
  & product_flow_type=<string>
  & [product_offer_id=<string>]
  & [product_id=<string>]
  & [offer_type=<string>]
  & [benefit_type=<string>]
  & [referrer_type=<string>]
  & [referrer_id=<string>]
  & [referrer_screen=<string>]
  & [step_type=<string>]
  & [step_option=<string>]
  & [result_status=<string>]
  & [price_unit=<string>]
  & [price_value=<decimal>]
  & [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*

A 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.

Alert

Do not pass this value together 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.

Alert

Do not pass this value together with the profile_id parameter. The server accepts only one of these parameters.

event_timestamp*

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 14 days. The API expects a value in seconds.

product_flow_type*

Offer event type. Possible values:

  • offer_shown — the user saw the offer;
  • flow_start — the user started the product flow;
  • step — an intermediate flow step;
  • flow_result — the final result of the scenario.

product_offer_id

Offer ID — a specific variant of the proposal. For example, a promo campaign or banner identifier. If the scenario started without an offer, you can omit this parameter.

product_id

Product ID in the app. For example, a loan, subscription, or booking. Links events within the same scenario.

offer_type

Offer category. For example, financial_product, subscription. Usually passed with product_flow_type=offer_shown.

benefit_type

Benefit type for the user. For example, discount_percentage, cashback. Usually passed with product_flow_type=offer_shown.

referrer_type

Referrer type for the offer. For example, banner, push, deeplink. Usually passed with product_flow_type=offer_shown.

referrer_id

Referrer ID. For example, a banner or push campaign identifier.

referrer_screen

Screen where the user saw the offer or started the flow. For example, main, catalog.

step_type

Name of an intermediate flow step. For example, documents, scoring. Passed with product_flow_type=step.

step_option

Step details. For example, passport_upload, automatic_scoring. Passed with product_flow_type=step.

result_status

Scenario outcome. Passed with product_flow_type=flow_result. Possible values:

  • success — completed successfully;
  • declined — rejected by a third party;
  • pending — awaiting a decision;
  • cancelled — cancelled by the user;
  • expired — the offer or session expired;
  • fail — a technical error.

For more information about statuses, see Product flow examples.

price_unit

Currency of the offer price or final scenario amount. List of available currencies. Pass together with price_value when the scenario includes an amount. For example, the service cost after a visit.

price_value

Amount in the price_unit currency. Pass together with price_unit.

payload

Additional scenario parameters in a {"key":"value"} format. For example, application_id, booking_id, campaign_id.

session_type

Session type. Possible values:

  • foreground — in the Events report, the Users metric increases.
  • background — in the Events report, the Devices metric increases. Such events are not included in reports with grouping by users or in the profile card.

Default value: background.

ios_ifa

The device's IFA in the format received from the device.

ios_ifv

IFV for the app in the format received from the device.

google_aid

The device's Google AID in the format received from the device.

windows_aid

The device's Windows AID in the format received from the device.

os_name

Operating system on the user's device: ios | android | windows.

os_version

The version of the operating system on the user's device.

device_manufacturer

The device manufacturer detected by the AppMetrica service (for example, Apple or Samsung).

device_model

The device model detected by the AppMetrica service (for example, Galaxy S6).

device_type

The device type detected by the AppMetrica service. Possible values: phone | tablet | unknown.

device_locale

The language on the device.

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.metro).

connection_type

Type of connection. Possible values: wifi | cell | unknown.

operator_name

Name of the mobile operator.

mcc

Mobile country code.

mnc

Mobile network code.

device_ipv6

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 The data has been uploaded successfully.
403 The request does not contain an authorization header, or the token is invalid.
400 The request does not contain one or more required parameters.

Sample request

POST /logs/v1/import/product_flow.csv?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012 HTTP/1.1
Host: api.appmetrica.yandex.com
Connection: close

application_id,appmetrica_device_id,event_timestamp,product_flow_type,product_offer_id,product_id,result_status,price_unit,price_value,payload,session_type
1234567890,1757762239877245682,1689943892,flow_result,credit_q1,personal_loan,success,RUB,123.45,"{""request_id"":""loan-42""}",background
POST /logs/v1/import/product_flow?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012&application_id=1234567890&appmetrica_device_id=1757762239877245682&event_timestamp=1689943892&product_flow_type=flow_result&product_offer_id=credit_q1&product_id=personal_loan&result_status=success&price_unit=RUB&price_value=123.45&payload="{""request_id"":""loan-42""}"&session_type=background HTTP/1.1
Host: api.appmetrica.yandex.com
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.

Contact support Suggest an improvement for documentation