Uploading Ad Revenue events
Transmits ad revenue info.
Usage example: You can use the Post API to transmit info about ad revenue from ad views linked to each app user.
Purchase events received via the Post API are used when calculating all metrics and are also available in funnels and cohorts.
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/adrevenue
? post_api_key=<string>
& application_id=<int>
& profile_id=<string>
& appmetrica_device_id=<int>
& event_timestamp=<int>
& revenue=<decimal>
& currency=<enum>
& ad_type=<enum>
& [ad_network=<string>]
& [ad_unit_id=<int>]
& [ad_unit_name=<string>]
& [ad_placement_id=<int>]
& [ad_placement_name=<string>]
& [precision=<enum>]
& [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 ( |
revenue * | Revenue per ad impression. Revenue amount in decimal(10.8) format (a decimal fraction with 10 digits before and 8 digits after the decimal point). |
currency * | Ad revenue currency. List of available currencies. |
ad_type * | Ad type. Available values: native, banner, rewarded, interstitial, mrec, and other . |
ad_network | Advertising network name. |
ad_unit_id | Unit ID from the advertising network. |
ad_unit_name | Unit name from the advertising network. |
ad_placement_id | Placement ID from the advertising network. |
ad_placement_name | Placement name from the advertising network. |
precision | Accuracy of data transmission. For example, |
payload | 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. |
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 ( |
revenue * | Revenue per ad impression. Revenue amount in decimal(10.8) format (a decimal fraction with 10 digits before and 8 digits after the decimal point). |
currency * | Ad revenue currency. List of available currencies. |
ad_type * | Ad type. Available values: native, banner, rewarded, interstitial, mrec, and other . |
ad_network | Advertising network name. |
ad_unit_id | Unit ID from the advertising network. |
ad_unit_name | Unit name from the advertising network. |
ad_placement_id | Placement ID from the advertising network. |
ad_placement_name | Placement name from the advertising network. |
precision | Accuracy of data transmission. For example, |
payload | 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. |
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/adrevenue.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,revenue,currency,ad_type,ad_network,ad_unit_id,ad_unit_name,ad_placement_id,ad_placement_name,precision,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,1757762239877245682,1689943892,0.0001,usd,banner,some_network_name,0987654321,some_unit_name,12345000,some_placement_name,estimated,"{""key"":""value_1""}",foreground,123456abcde,54321edcba,098765abcde,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/adrevenue.csv?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012&application_id=1234567890&profile_id=1234567890abcdef&appmetrica_device_id=1757762239877245682&event_timestamp=1689943892&revenue=0.0001¤cy=usd&ad_type=banner&ad_network=some_network_name&ad_unit_id=0987654321&ad_unit_name=some_unit_name&ad_placement_id=12345000&ad_placement_name=some_placement_name&precision=estimated&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