Server to Server 集成文档
一、注意事项:
- 数据报送:https://log.tkioglobal.com
- 所有请求格式统一使用UTF-8编码,请求方式使用post;
"_deviceid"为基本参数,用来记录用户设备身份信息,iOS获取"_idfa"和"_idfv",Android获取"_gaid"和"_androidid",同一台设备的同一应用请保持参数一致;
报送的头信息中一定要有Content-Type=application/json参数。
二、激活(首次安装打开应用)
地址:
/receive/tkioglobal/install
参数说明:
| 参数名 | 是否必传 | 参数类型 | 说明 |
|---|---|---|---|
| appid | 是 | String | APP GUID |
| who | 是 | String | idfa或gaid值 |
| what | 是 | String | install |
| when | 是 | Date | 发生时间 |
| context | 是 | HashMap | 上下文信息 |
上下文信息:
| 参数名 | 是否必传 | 参数类型 | 说明 |
|---|---|---|---|
| _deviceid | 是 | String | idfa或gaid值 |
| _idfa | 仅IOS,是 | String | iOS广告标识符 |
| _idfv | 仅IOS,是 | String | iOS厂商标识符 |
| _androidid | 仅Android,是 | String | Android手机唯一识别码 |
| _gaid | 仅Android,是 | String | GooglePlay advertising id |
| _mac | 是 | String | mac地址 |
| _ip | 是 | String | 客户端IP,IPV4 |
| _ipv6 | 是 | String | 客户端IP,IPV6 |
| _lats | 仅iOS,是 | String | 是否开启限制广告追踪0为开启1为未开启 |
| _jbk | 仅iOS,否 | String | 是否越狱0为未越狱1为越狱 |
| _modify | 仅iOS,否 | String | 是否重置IDFA0为未重置1为重置 |
| _frequency | 仅iOS,否 | String | Idfa变化频率 |
| _istablet | 仅Android,否 | String | 是否是tablet设备 |
| _tz | 是 | String | UTC时区,例:北京为+8,伦敦为+0 |
| _manufacturer | 是 | String | 设备品牌 |
| _ryos | 是 | String | 设备系统。iOS:填写iOS,Android:填写Android |
| _ryosversion | 是 | String | 设备系统的版本,例如10.1.2 |
| _rydevicetype | 是 | String | 设备类型如iPhone |
| _model | 是 | String | 设备型号如iPhone 5 |
| _network_type | 否 | String | 网络制式3G、4G、WIFI |
| _resolution | 否 | String | 分辨率 |
| _carrier | 否 | String | 运营商中国移动、中国联通、中国电信 |
| _app_version | 是 | String | app版本例如:1.0.0 |
| _pkgname | 否 | String | 应用包名如 com.reyun.tkioglobal |
| _create_timestamp | 是 | String | 数据发生时间,13位时间戳 |
| _timestamp | 是 | String | 数据上传时间,13位时间戳 |
| _lib | 是 | String | SDK类型,如Android、iOS |
| _lib_version | 是 | String | SDK版本,如 a1.0.0 |
| _channelid | 是 | String | 默认:_default_ |
激活示例代码:
iOS
{"appid":"xxxxxxxxxxxxxxxx","who":"88DF8986-6E80-4B6D-8CD0-DBB402A80D18","what":"install","when":"2019-09-16 21:28:58","context":{"_manufacturer":"苹果","_lats":"1","_network_type":"WIFI","_timestamp":"1570636195286","_ipv6":"fe80::14b0:e376:7689:94da","_tz":"+8","_pkgname":"com.reyun.tkioglobal","_app_version":"1.2.0","_jbk":"0" ,"_model":"iPhone 6s Plus","_idfv":"11288275-88C7-4880-8F86-485BE1AE88BB","_ip":"182.24.186.103","_frequency":"0.000","_mac":"02:00:00:00:00:00","_ryos":"ios","_create_timestamp":"1570636195286","_modify":"0","_idfa":"88DF8986-6E80-4B6D-8CD0-DBB402A80D18","_ryosversion":"2.3.2","_resolution":"736*414","_lib":"iOS","_lib_version":"a1.0.0","_deviceid":"88DF8986-6E80-4B6D-8CD0-DBB402A80D18","_rydevicetype":"iPhone","_channelid":"_default_","_carrier":"CMCC"}}
Android
{"appid":"xxxxxxxxxxxxxxxx","who":"0ae7902f-706e-4b84-aa63-b19374847086","what":"install","when":"2019-09-16 21:28:58","context":{"_manufacturer":"GIONEE","_istablet":"phone","_network_type":"WIFI","_timestamp":"1570595189312","_ipv6":"8809:8802:88bd:8888::1_8","_tz":"+8","_pkgname":"com.reyun.tkioglobal","_app_version":"1.0.3","_ry_origin_when":"2019-10-09 12:26:29","_model":"GN8003","_ip":"111.56.114.13","_lib":"Android","_androidid":"cf8a0888ff8e08ef","_mac":"08:88:08:88:88:F3","_ryos":"Android","_create_timestamp":"1570595189170","_resolution":"1080*1920","_ryosversion":"6.0","_gaid":"0ae7902f-706e-4b84-aa63-b19374847086","_lib":"Android","_lib_version":"a1.0.0","_channelid":"_default_","_rydevicetype":"GN8003","_deviceid":"0ae7902f-706e-4b84-aa63-b19374847086","_carrier":"CMCC"}}
三、事件(Post-install Events)
所有事件必传参数
| 参数名 | 是否必传 | 参数类型 | 说明 |
|---|---|---|---|
| appid | 是 | String | APP GUID |
| who | 是 | String | idfa或gaid |
| what | 是 | String | 详见各事件选填参数 |
| when | 是 | Date | 发生时间 |
| context | 是 | HashMap | 上下文信息 |
上下文信息:
| 参数名 | 是否必传 | 参数类型 | 说明 |
|---|---|---|---|
| _deviceid | 是 | String | idfa或gaid |
| _idfa | 仅IOS | String | iOS广告标识符 |
| _idfv | 仅IOS | String | iOS厂商标识符 |
| _androidid | 仅Android | String | Android手机唯一识别码 |
| _gaid | 仅Android | String | GooglePlay adverting id |
| _ip | 是 | String | 客户端IP |
| _app_version | 是 | String | app版本例如:1.0.0 |
| _ryosversion | 是 | String | 设备系统的版本,例如10.1.2 |
| _create_timestamp | 是 | String | 数据发生时间,13位时间戳 |
| _timestamp | 是 | String | 数据上传时间,13位时间戳 |
| _lib | 是 | String | SDK类型,如Android、iOS |
| _lib_version | 是 | String | SDK版本,如 a1.0.0 |
| _tz | 是 | String | UTC时区,例:北京为+8,伦敦为+0 |
标准事件选填参数(Standard Events)
注意:
1.what为热云识别各事件的标识符,必传;
2.上报各事件对应的选填参数,可通过热云帮助您查看和导出维度更丰富的报告,并参与数据分析和广告优化。
1.启动
地址:/receive/tkioglobal/startup
what:startup
参数说明:
无额外可需添加的参数
建议:启动事件为统计活跃用户和留存率,单个设备每日上报一次即可
2.注册
地址:/receive/tkioglobal/reged
what:reged
参数说明:
| user_name | String | 用户名称标识 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| referral_from | String | 事件引荐来源 |
3.登录
地址:/receive/tkioglobal/loggedin
what:loggedin
参数说明:
| user_name | String | 用户名称标识 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| referral_from | String | 事件引荐来源 |
4.付费
地址:/receive/tkioglobal/payment
what:payment
参数说明:
| name | String | 付费名称 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| checkout_as_guest | string | 任何有关游客下单的数据 |
| content_id | 付费商品id | |
| _transactionid | string | 流水单id,确保唯一 |
| _currencytype | string | 货币类型,按照国际标准组织ISO4217中规范的3位大写字母,如USD |
| _currencyamount | number | 付费金额 |
5.订单
地址:/receive/tkioglobal/order
what:order
参数说明:
| name | String | 付费名称 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| checkout_as_guest | string | 任何有关游客下单的数据 |
| content_id | 下单商品id | |
| _transactionid | string | 流水单id,确保唯一 |
| _currencytype | string | 货币类型,按照国际标准组织ISO4217中规范的3位大写字母,如USD |
| _currencyamount | number | 订单金额 |
6.订阅
地址:/receive/tkioglobal/subscribe
what:subscribe
参数说明:
| name | String | 订阅名称 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| checkout_as_guest | string | 任何有关游客下单的数据 |
| content_id | 订阅商品id | |
| _transactionid | string | 流水单id,确保唯一 |
| _currencytype | string | 货币类型,按照国际标准组织ISO4217中规范的3位大写字母,如USD |
| _currencyamount | number | 订阅金额 |
7.搜索
地址:/receive/tkioglobal/search
what:search
参数说明:
| uri | String | 搜索内容 |
|---|---|---|
| results | String | 搜索结果 |
8.浏览
地址:/receive/tkioglobal/view
what:view
参数说明:
| name | String | 浏览内容 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| referral_from | String | 事件引荐来源 |
| content_id | string | 浏览内容唯一id |
9.加购物车
地址:/receive/tkioglobal/addtocart
what:addtocart
参数说明:
| name | String | 加购内容 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| referral_from | String | 事件引荐来源 |
| content_id | string | 加购内容唯一id |
10.加收藏
地址:/receive/tkioglobal/addtowishlist
what:addtowishlist
参数说明:
| name | String | 收藏内容 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| referral_from | String | 事件引荐来源 |
| content_id | string | 收藏内容唯一id |
11.完成教程
地址:/receive/tkioglobal/tutorialcomplete
what:tutorialcomplete
参数说明:
| name | String | 教程名称 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| duration | String | 完成教程所花费的时间,单位:秒 |
12.达成等级
地址:/receive/tkioglobal/levelcomplete
what:levelcomplete
参数说明:
| name | String | 等级信息 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| duration | String | 达成等级所花费的时间,单位:秒 |
13.达成成就
地址:/receive/tkioglobal/achievement
what:achievement
参数说明:
| name | String | 成就信息 |
|---|---|---|
| user_id | String | 用户唯一id(账号id) |
| duration | String | 达成成就所花费的时间,单位:秒 |
14.广告点击
地址:/receive/tkioglobal/adclick
what:adclick
参数说明:
| ad_type | String | 广告类型或唯一标识(id) |
|---|---|---|
| ad_network_name | String | 广告平台名称 |
| placement | String | 广告位名称 |
15.广告展示
地址:/receive/tkioglobal/adview
what:adview
参数说明:
| ad_type | String | 广告类型或唯一标识(id) |
|---|---|---|
| ad_network_name | String | 广告平台名称 |
| placement | String | 广告位名称 |
16.用户评分
地址:/receive/tkioglobal/rating
what:rating
参数说明:
| rating_value | number | 用户评分值 |
|---|---|---|
| max_rating_value | number | 最高评分值 |
事件示例代码
iOS
{"appid":"xxxxxxxxxxxxxxxx","who":"88DF8986-6E80-4B6D-8CD0-DBB402A80D18","what":"payment","when":"2019-09-16 21:28:58","context":{"_timestamp":"1570636195286","_app_version":"1.2.0","_idfv":"11288275-88C7-4880-8F86-485BE1AE88BB","_create_timestamp":"1570636195286","_idfa":"88DF8986-6E80-4B6D-8CD0-DBB402A80D18","_lib":"iOS","_lib_version":"a1.0.0","_deviceid":"88DF8986-6E80-4B6D-8CD0-DBB402A80D18","_ip":"1.1.1.1","_ryosversion":"13.0.1","_tz":"+8","name":”applepaypurchase”,”user_id”:”uniqueuserid”,"checkout_as_guest":””,”content_id”:”kidshoes12345”,"_currencytype":”USD”,” _currencyamount”:150}}
Android
{"appid":"xxxxxxxxxxxxxxxx","who":"efffb2c0-aaaf-888-eeff-f6d889ef88f88","what":"payment","when":"2019-09-16 21:28:58","context":{"_timestamp":"1570636195286","_app_version":"1.2.0","_androidid":"cf8a0888ff8e08ef","_create_timestamp":"1570636195286","_gaid":"efffb2c0-aaaf-888-eeff-f6d889ef88f88","_lib":"Android","_lib_version":"a1.0.0","_deviceid":"efffb2c0-aaaf-888-eeff-f6d889ef88f88","_ip":"1.1.1.1","_ryosversion":"13.0.1","_tz":"+8","name":”applepaypurchase”,”user_id”:”uniqueuserid”,"checkout_as_guest":””,”content_id”:”kidshoes12345”,"_currencytype":”USD”,” _currencyamount”:150}}
自定义事件选填参数(Custom Events)
注意:
1.自定义事件what为自定义值,必传,自定义事件中what不能与标准事件what相同,且各自定义事件what不能相同;
2.后台每个app最多可现实100个事件的上报数据(包括标准事件);
3."custom_param"为选填参数json串,每个自定义事件的选填参数最多可携带20个键值对,键为String型,值不做要求。
地址:
/receive/tkioglobal/event
参数说明:
| what | string | 事件名称 |
|---|---|---|
| custom_param | json字符串 | 自定义事件参数 |
自定义事件示例代码:
iOS
{"appid":"xxxxxxxxxxxxxxxx","who":"88DF8986-6E80-4B6D-8CD0-DBB402A80D18","what":"custom_eventname1","when":"2019-09-16 21:28:58","context":{"_timestamp":"1570636195286","_app_version":"1.2.0","_idfv":"11288275-88C7-4880-8F86-485BE1AE88BB","_create_timestamp":"1570636195286","_idfa":"88DF8986-6E80-4B6D-8CD0-DBB402A80D18","_lib":"iOS","_lib_version":"a1.0.0","_deviceid":"88DF8986-6E80-4B6D-8CD0-DBB402A80D18","_ip":"1.1.1.1","_ryosversion":"13.0.1","_tz":"+8","custom_param":{"custom_key123":"value123","custom_key456":"value123","custom_key789":"value123"}}}
Android
{"appid":"xxxxxxxxxxxxxxxx","who":"efffb2c0-aaaf-888-eeff-f6d889ef88f88","what":"custom_eventname2","when":"2019-09-16 21:28:58","context":{"_timestamp":"1570636195286","_app_version":"1.2.0","_androidid":"cf8a0888ff8e08ef","_create_timestamp":"1570636195286","_gaid":"efffb2c0-aaaf-888-eeff-f6d889ef88f88","_lib":"Android","_lib_version":"a1.0.0","_deviceid":"efffb2c0-aaaf-888-eeff-f6d889ef88f88","_ip":"1.1.1.1","_ryosversion":"13.0.1","_tz":"+8","custom_param":{"custom_key123":"value123","custom_key456":"value123","custom_key789":"value123"}}}
四、HTTP status code检查
正常
{"status":0}
错误
{
"result":{
"who": "can not be null!" //缺少必填字段who
},
"status": -1 //正确为0,错误为-1
}
注:错误415,请检查头信息中是否有Content-Type=application/json参数