上传应用内收入事件
传输关于购买的数据。
使用示例:如果您的应用中的购买不是通过 Google Play 或 AppStore 完成,也没有在客户端进行跟踪,您可以通过 Post API 将 In-App 收入事件发送到 Analytics module。 如果您自行在应用内跟踪订阅数据或使用第三方服务,您可以通过 Post API 传输订阅数据。
通过 Post API 接收的购买事件用于计算所有指标,也可在漏斗和分群中使用。
通过 Post API 接收的收入事件不会被验证,总是被视为有效。
事件属性可以通过参数或请求体传递。 当您在正文中传递数据时,应将.csv添加到请求的URL中。 要了解更多信息,请查看示例请求。
要将事件绑定到用户,请在请求中使用以下字段之一:
profile_idappmetrica 设备 ID
Post API 有数据加载限制。 要了解更多信息,请查看限制。
请求格式
提交 https://api.boost.yandex.com/logs/v1/import/revenue
? post_api_key=<string>
& application_id=<int>
& profile_id=<string>
& appmetrica_device_id=<int>
& revenue_event_type=<string>
& event_timestamp=<int>
& price=<decimal>
& currency=<string>
& product_id=<string>
& [quantity=<int>]
& [payload=<string>]
& [transaction_id=<int>]
& [order_id=<int>]
& [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>]
|
|
用于数据上传的令牌。 您可以在应用的 设置 部分获取它。 |
|
|
应用在 Analytics module 中的唯一数字标识符。 |
|
|
用户个人资料 ID。 Post API 仅允许您上传先前通过 SDK 发送的标识符的数据。 不要传递 |
|
|
Analytics module 设置的设备唯一标识符的哈希。 Post API 仅允许您上传先前通过 SDK 发送的标识符的数据。 不要传递 |
|
|
购买事件类型。 可用类型列表:
|
|
|
事件的时间,格式为 Unix time。 使用 Post API,您只能在事件日期(event_timestamp)与上传日期之间的差异不超过 14 天时上传事件。 API 期望以秒为单位的值。 |
|
|
价格。 收入金额,格式为 decimal(10.8)(小数点前 10 位、小数点后 8 位的十进制小数)。 |
|
|
购买的货币。 可用货币列表. 三字元货币代码以大写字母传递。 |
|
|
商品 ID。 |
|
|
购买的产品数量。默认值: |
|
|
任意负载:以键值对形式呈现的附加信息。 最大大小为 30 KB。 如果值超过此限制,Analytics module 将截断它。 |
|
|
唯一交易 ID。 |
|
|
订单 ID。 |
|
|
会话类型。 可能的值:
Default value is |
|
|
设备的 IFA,格式为从设备接收的格式。 |
|
|
应用的 IFV,格式为从设备接收的格式。 |
|
|
设备的 Google AID,格式为从设备接收的格式。 |
|
|
设备的 Windows AID,格式为从设备接收的格式。 |
|
|
用户设备上的操作系统: |
|
|
用户设备上的操作系统版本。 |
|
|
Analytics 服务检测到的设备制造商(例如,Apple 或 Samsung)。 |
|
|
Analytics 服务检测到的设备类型。 可能的值: |
|
|
设备上的语言。 |
|
|
开发者指定的应用版本格式。 |
|
|
Android 的包名,或 iOS 的 Bundle ID(例如,ru.yandex.metro)。 |
|
|
连接类型。 可能的值: |
|
|
移动运营商名称。 |
|
|
移动国家代码。 |
|
|
移动网络代码。 |
|
|
事件时的 IP 地址,格式为 IPv6。 例如,2a02:6b8::40c:6676:baff:fea6:53d8, ::ffff:5.255.232.147。 |
Response codes
| Code | 描述 |
|---|---|
| 200 | 数据已成功上传。 |
| 403 | 请求缺少授权头,或者指定的令牌无效。 |
| 400 | 请求缺少一个或多个必需参数。 |
示例请求
POST /logs/v1/import/revenue.csv?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012 HTTP/1.1
Host: api.boost.yandex.com
Content-Length: 540i
Connection: close
appmetrica_device_id,device_model,device_type,google_aid,app_package_name,operator_name,mnc,application_id,account_id,event_timestamp,price,currency,product_id,quantity,transaction_id,order_id,revenue_event_type
1757762239877245682,iPhone X,phone,01234567-890a-bcde-f012-3456789abcde,com.yandex.sample.metrica,MegaFon,2,1111,1234567890123456789,1689943892,0.0001,USD,some_product1,1,transact1,8101,promo_started
1757762239877245682,iPhone X,phone,76543210-890a-bcde-f012-3456789abcde,com.yandex.sample.metrica,MegaFon,2,1111,9876543210987654321,1689943892,0.0001,USD,some_product2,2,transact2,1234,expired
POST /logs/v1/import/revenue?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012&appmetrica_device_id=1757762239877245682&device_model=iPhoneX&device_type=phone&google_aid=01234567-890a-bcde-f012-3456789abcde&app_package_name=com.yandex.sample.metrica&operator_name=MegaFon&mnc=2&application_id=1111&account_id=1234567890123456789&event_timestamp=1689943892&price=0.0001¤cy=USD&product_id=some_product1&quantity=1&transaction_id=transact1&order_id=8101&revenue_event_type=promo_started HTTP/1.1
Host: api.boost.yandex.com
Content-Length: 0
Connection: close
其他 Post API 方法
如果您没有找到所需答案,可以通过反馈表单提交您的问题。 请尽可能详细地描述问题。 如果可能,请附上截图。