模型查询API
本文档所描述的内容属于TA的高级使用功能,涉及较多技术细节,适用于对相关功能有经验的用户参考。如果对文档内容有疑惑,请咨询您的数据咨询顾问获取一对一的协助。
模型查询 API 主要用于获取各种数据分析报告。
1.调用方法
请参见Open API文档中的调用方法描述。
2.通用参数
2.1属性表达
几乎所有的 API 都会用到属性,例如按照某个属性进行过滤、分组或者聚合等等。属性包括事件属性,用户属性和用户分群属性,属性通常使用名称和表类型两个字段表达。例如表示 省份 这个事件属性的表达式如下:
"tableType":"event"
"columnName":"#province"
用户属性类似,例如表示 用户级别:
"tableType":"user"
"columnName":"user_level"
2.2 筛选表达式
筛选表达式同样适用于绝大多数 API,用于表示对某些事件或者用户的筛选操作,使用如下格式的 JSON 表示:
{
// 表示 filts 里的各个条件的关系是 或 还是 且
"relation": "and",
// 具体的条件列表,可以有多个
"filts": [{
// 条件的左值,是一个属性
"tableType":"event",
"columnName": "#os",
// 条件的比较符,这里表示等于
"comparator": "equal",
// 条件的比较值,根据不同的比较符可以有一个或者多个
"ftv": [
"ios"
]
},
{
"tableType":"user",
"columnName":"user_level",
"comparator": "equal",
"ftv": [
"5"
]
}]
}
目前支持的操作符如下:
- equal / notEqual
表示等于/不等于,对字符串、数值类型有效。如果 ftv 有多个,则相当于 In 或者 Not In。例如想筛选出来等级为3和4的用户:
{
"tableType":"user"
"columnName":"user_level"
"comparator": "equal",
"ftv": ["3","5"]
}
- isTrue / isFalse
只对布尔类型有效。
- isNull / notNull
某个属性是否有值,对字符串、数值类型有效。
- include / notInclude
表示包含或不包含某个子串:
{
"tableType":"user"
"columnName":"channel"
"comparator": "include",
"ftv": ["应用宝"]
}
- less / greater / range:表示小于/大于/小于且大于,其中 range 是前闭后闭的区间,对数值类型和时间类型有效。例如筛选物品剩余数量在 3 和 9 之间的所有事件:
{ "tableType":"event" "columnName":"count_left" "comparator": "range", "ftv": [3, 9] }
或者筛选所有最后登录时间在2019-11-13 00:00~2019-11-23 00:00之间的用户
{
"tableType":"user"
"columnName":"latest_login_time"
"comparator": "range",
"ftv":["2019-11-13 00:00","2019-11-23 00:00"]
}
- regexMatch / notRegexMatch
正则匹配或者正则不匹配,只对字符串类型有效。
- relativeCurrentBetween / relativeCurrentBefore
针对日期类型的操作符,分别表示 相对当前时间在过去N天到过去M天之间/相对当前时间在过去N天之前。例如想筛选所有注册时间相对当前时间在过去3天之前的用户:
{
"tableType":"user"
"columnName":"register_time"
"comparator": "relativeCurrentBefore",
"ftv": [3]
}
或者筛选所有注册时间相对当前时间在过去9天到过去3天之间的用户:
{
"tableType":"user"
"columnName":"register_time"
"comparator": "relativeCurrentBetween",
"ftv": [9, 3]
}
- relativeEventBefore / relativeEventAfter / relativeEventAbsolute
针对日期类型的操作符,分别表示 相对事件发生时刻在之前N长时间之内/相对事件发生时刻在之后N长时间之内/相对事件发生时刻在前后N长时间之内。例如想筛选用户上次登录时间相对事件发生时刻在之前3个小时之内的事件:
{
"tableType":"user"
"columnName":"latest_login_time"
"comparator": "relativeEventBefore",
"ftv": [3]
"timeUnit": "hour"
}
- arrayIncludeItem / arrayNotIncludeItem
列表类型的操作符,表示列表是否包含某些元素
- arrayItemPos
列表类型的操作符,表示列表第n个元素等于某个值
- arrayIsNull / arrayNotNull
列表类型的操作符,表示列表是否存在
3. 行为分析
3.1 事件分析
3.1.1 普通分析
[POST /open/event-analyze?token=xxxxxxx]
Request body (application/json)
{ // 项目Id "projectId": 0, "events": [ { // normal 普通分析, customized 自定义公式 "type": "normal", // 事件名称,特别的,可以使用 anyEvent 表示任意事件 "eventName": "buy_shopitem", // (可选)分析的属性名称 "quota": "", // 分析类型,聚合操作 "analysis": "TOTAL_TIMES", "relation": "and", "filts": [ { "columnName": "user_level", "comparator": "greater", "ftv": [ "3" ], "tableType": "user" }, { "columnName": "#os", "comparator": "equal", "ftv": [ "android" ], "tableType": "event" }, { "columnName": "#lib", "comparator": "equal", "ftv": [ "android" ], "tableType": "event" } ] } ], "eventView": { // 结束时间 "endTime": "2019-11-26 00:00:00", //(可选)分组属性,可以有零个或者多个 "groupBy": [ { "columnName": "#screen_width", // 自定义属性区间 "propertyRange": "2000,3000", // 属性区间类型,对数值型属性进行分组时,可以为自定义分桶条件 "propertyRangeType": "user_defined", "tableType": "event" }, { "columnName": "#screen_height", "propertyRange": "2000", "propertyRangeType": "user_defined", "tableType": "event" } ], // 起始时间 "startTime": "2019-11-24 00:00:00", // 时间单位,可以是 minute/hour/day/week/month/total "timeParticleSize": "day" }, "useCache": true }
关键参数说明:
- analysis: 分析类型,可取值为:
- TOTAL_TIMES: 总次数
- TRIG_USER_NUM: 触发用户数
- PER_CAPITA_TIMES: 人均次数
- SUM: 数值总和
- AVG: 数值平均值
- PER_CAPITA_NUM: 人均值
- MAX: 数值最大值
- MIN: 数值最小值
- DISTINCT: 去重数
- TRUE: 为真数
- FALSE: 为假数
- IS_NOT_EMPTY: 不为空数
- IS_EMPTY: 为空数
- STAGE_ACC: 阶段累计总和
- STAGE_ACC_PCV: 阶段累计人均值
- ARRAY_DISTINCT: 列表去重数
- ARRAY_ITEM_DISTINCT: 列表元素去重数
- quota: 若analysis为SUM/MAX/MIN/AVG,需要添加quota字段,即聚合的字段名,与analysis同级,例如:"quota" : "count_left"
- propertyRangeType: 数值型属性区间类型
- def: 默认区间
- discrete: 离散数字
- user_defined: 用户自定义
- propertyRange: 自定义数值型属性区间,对数值型属性进行分组时,可以自定义属性区间
- analysis: 分析类型,可取值为:
curl示例
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"eventView":{"comparedByTime":true,"comparedEndTime":"2018-10-18 00:00:00","comparedStartTime":"2018-09-16 00:00:00","endTime":"2018-11-02 00:00:00","groupBy":[{"columnName":"#province","tableType":"event"}],"startTime":"2018-10-01 00:00:00","timeParticleSize":"day"},"events":[{"analysis":"TOTAL_TIMES","eventName":"use_item","quota":"","type":"normal"},{"analysis":"PER_CAPITA_TIMES","eventName":"participate_activity","filts":[{"columnName":"#manufacturer","comparator":"equal","ftv":["iphone"],"tableType":"event"}],"quota":"","relation":"and","type":"normal"},{"analysis":"TOTAL_TIMES","eventName":"use_item","quota":"","type":"normal"},{"analysis":"PER_CAPITA_TIMES","eventName":"participate_activity","filts":[{"columnName":"#manufacturer","comparator":"equal","ftv":["iphone"],"tableType":"event"}],"quota":"","relation":"and","type":"normal"}],"projectId":102,"useCache":true}' 'http://dev-ta2:8992/open/event-analyze?token=bTOzKiTIozG4e19FgXphcA8dDV3DIY8RwdHTO7aSnBsRqSNaIk19BnBMecJDWibD'
Response body (application/json)
返回内容代表了一张结果表格,表格标题是时间,表格内容每行代表了某个分组的分析结果。
分析对象 | 分组 | x[0] | x[1] | x[2] |
---|---|---|---|---|
y[0]."buy_shopitem.TOTAL_TIMES" | y[0]."buy_shopitem.TOTAL_TIMES"[0].group_cols | y[0]."buy_shopitem.TOTAL_TIMES"[0].values[0] | y[0]."buy_shopitem.TOTAL_TIMES"[0].values[1] | y[0]."buy_shopitem.TOTAL_TIMES"[0].values[2] |
y[0]."buy_shopitem.TOTAL_TIMES" | y[0]."buy_shopitem.TOTAL_TIMES"[1].group_cols | y[0]."buy_shopitem.TOTAL_TIMES"[1].values[0] | y[0]."buy_shopitem.TOTAL_TIMES"[1].values[1] | y[0]."buy_shopitem.TOTAL_TIMES"[1].values[2] |
{
"return_code": 0,
"return_message": "success",
"data": {
"union_groups": [
[
"-∞~2000",
"2000~+∞"
],
[
"-∞~2000",
"-∞~2000"
]
]
"x": [
"2019-11-24",
"2019-11-25",
"2019-11-26"
],
"y": [
{
"buy_shopitem.TOTAL_TIMES": [
{
"group_cols": [
"-∞~2000",
"2000~+∞"
],
"values": [
"507",
"2127",
"1550"
],
"group_num": 2
},
{
"group_cols": [
"-∞~2000",
"-∞~2000"
],
"values": [
"663",
"398",
"694"
],
"group_num": 2
}
]
}
]
}
}
3.1.2 自定义公式
- 使用公式 Request (application/json)
{ "eventView": { "endTime": "2019-11-27 00:00:00", "groupBy": [ { "columnName": "#screen_width", "propertyRange": "2000,3000", "propertyRangeType": "user_defined", "tableType": "event" }, { "columnName": "#screen_height", "propertyRange": "2000", "propertyRangeType": "user_defined", "tableType": "event" } ], "projectId": 0, "recentDay": "1-3", "startTime": "2019-11-25 00:00:00", "timeParticleSize": "day" }, "events": [ { "customEvent": "consume_item.PER_CAPITA_TIMES+obtain_item.PER_CAPITA_TIMES", // 自定义一个名字 "eventName": "公式demo", "format": "float", // customized 自定义公式 "type": "customized" } ], "useCache": true }
关键参数说明:
- customEvent: 公式表达式,由分析项或数值常量的加减乘除构成。分析项有两种形式: eventName.columnName.analysis 或 eventName.analysis。analysis 取值见 3.1.1 普通分析关键参数说明。
- propertyRangeType: 数值型属性区间类型
- def: 默认区间
- discrete: 离散数字
- user_defined: 用户自定义
- propertyRange: 自定义数值型属性区间,对数值型属性进行分组时,可以自定义属性区间
- 使用公式 Response body (application/json)
返回内容代表了一张结果表格,表格标题是时间,表格内容每行代表了某个分组的分析结果。
分析对象 | 分组 | x[0] | x[1] | x[2] |
---|---|---|---|---|
y[0]."公式demo" | y[0]."公式demo"[0].group_cols | y[0]."公式demo"[0].values[0] | y[0]."公式demo"[0].values[1] | y[0]."公式demo"[0].values[2] |
y[0]."公式demo" | y[0]."公式demo"[1].group_cols | y[0]."公式demo"[1].values[0] | y[0]."公式demo"[1].values[1] | y[0]."公式demo"[1].values[2] |
{
"data": {
"union_groups": [
[
"-∞~2000",
"2000~+∞"
],
[
"-∞~2000",
"-∞~2000"
]
],
"group_num": 2,
"x": [
"2019-11-25",
"2019-11-26",
"2019-11-27"
],
"y": [
{
"公式demo": [
{
"group_cols": [
"-∞~2000",
"2000~+∞"
],
"values": [
"411.42",
"538.65",
"429.31"
],
"group_num": 2
},
{
"group_cols": [
"-∞~2000",
"-∞~2000"
],
"values": [
"336.3",
"418.33",
"515.61"
],
"group_num": 2
}
]
}
],
"cols_format_List": [
"string",
"string"
],
"type": [
null,
null
]
},
"return_code": 0,
"return_message": "success"
}
3.2 留存分析
[POST /open/retention-analyze?token=xxxxxxx]
Request body (application/json)
{ "projectId": 0, "events": [ { // 第一个事件 "type": "first", "eventName": "player_register", "filts": [ { "columnName": "user_level", "comparator": "greater", "ftv": [ "2" ], "tableType": "user" } ], "relation": "and" }, { // 第二个事件 "type": "second", "eventName": "obtain_diamond", "filts": [ { "columnName": "#os", "comparator": "equal", "ftv": [ "android" ], "tableType": "event" }, { "columnName": "user_level", "comparator": "greater", "ftv": [ "2" ], "tableType": "user" } ], "relation": "and" }, { // (可选)同时显示第三个指标 "type": "simultaneous_display", "eventName": "consume_item", "analysis": "PER_CAPITA_NUM", "quota": "#vp@dailyTask", "filts": [ { "columnName": "user_level", "comparator": "greater", "ftv": [ "2" ], "tableType": "user" } ], "relation": "and" } ], "eventView": { // 结束时间 "endTime": "2019-11-26 00:00:00", // 起始时间 "startTime": "2019-11-24 00:00:00", // 统计类型: retention 留存, lost 流失 "statType": "retention", // 时间单位 "timeParticleSize": "day", // 留存期限 "unitNum": 3 }, "useCache": true }
Response 200 (application/json)
返回内容代表了一张结果表格,表格标题是当日到n日后。表格内容每行代表了某天的指标,指标有以下三种类型:
类型 | 含义 |
---|---|
0 | 留存 |
1 | 流失 |
2 | 同时展示 |
阶段平均的留存或流失用户数作为特殊的几行
类型 | 初始事件时间 | 分组 | 初始事件用户数 | 当日 | 1日后 | 2日后 | 3日后 |
---|---|---|---|---|---|---|---|
0 | 阶段均值 | state_avg.0[0].groupCols | state_avg.0[0].values[0] | state_avg.0[0].values[1] | state_avg.0[0].values[2] | state_avg.0[0].values[3] | state_avg.0[0].values[4] |
1 | 阶段均值 | state_avg.1[0].groupCols | state_avg.1[0].values[0] | state_avg.1[0].values[1] | state_avg.1[0].values[2] | state_avg.1[0].values[3] | state_avg.1[0].values[4] |
2 | 阶段均值 | state_avg.2[0].groupCols | state_avg.2[0].values[0] | state_avg.2[0].values[1] | state_avg.2[0].values[2] | state_avg.2[0].values[3] | state_avg.2[0].values[4] |
0 | y.0.2019-11-24 | y.0.2019-11-24[0].groupCols | y.0.2019-11-24[0].values[0] | y.0.2019-11-24[0].values[1] | y.0.2019-11-24[0].values[2] | y.0.2019-11-24[0].values[3] | y.0.2019-11-24[0].values[4] |
0 | y.0.2019-11-25 | y.0.2019-11-25[0].groupCols | y.0.2019-11-25[0].values[0] | y.0.2019-11-25[0].values[1] | y.0.2019-11-25[0].values[2] | y.0.2019-11-25[0].values[3] | y.0.2019-11-25[0].values[4] |
0 | y.0.2019-11-26 | y.0.2019-11-26[0].groupCols | y.0.2019-11-26[0].values[0] | y.0.2019-11-26[0].values[1] | y.0.2019-11-26[0].values[2] | y.0.2019-11-26[0].values[3] | y.0.2019-11-26[0].values[4] |
1 | y.1.2019-11-24 | y.1.2019-11-24[0].groupCols | y.1.2019-11-24[0].values[0] | y.1.2019-11-24[0].values[1] | y.1.2019-11-24[0].values[2] | y.1.2019-11-24[0].values[3] | y.1.2019-11-24[0].values[4] |
1 | y.1.2019-11-25 | y.1.2019-11-25[0].groupCols | y.1.2019-11-25[0].values[0] | y.1.2019-11-25[0].values[1] | y.1.2019-11-25[0].values[2] | y.1.2019-11-25[0].values[3] | y.1.2019-11-25[0].values[4] |
1 | y.1.2019-11-26 | y.1.2019-11-26[0].groupCols | y.1.2019-11-26[0].values[0] | y.1.2019-11-26[0].values[1] | y.1.2019-11-26[0].values[2] | y.1.2019-11-26[0].values[3] | y.1.2019-11-26[0].values[4] |
2 | y.2.2019-11-24 | y.2.2019-11-24[0].groupCols | y.2.2019-11-24[0].values[0] | y.2.2019-11-24[0].values[1] | y.2.2019-11-24[0].values[2] | y.2.2019-11-24[0].values[3] | y.2.2019-11-24[0].values[4] |
2 | y.2.2019-11-25 | y.2.2019-11-25[0].groupCols | y.2.2019-11-25[0].values[0] | y.2.2019-11-25[0].values[1] | y.2.2019-11-25[0].values[2] | y.2.2019-11-25[0].values[3] | y.2.2019-11-25[0].values[4] |
2 | y.2.2019-11-26 | y.2.2019-11-26[0].groupCols | y.2.2019-11-26[0].values[0] | y.2.2019-11-26[0].values[1] | y.2.2019-11-26[0].values[2] | y.2.2019-11-26[0].values[3] | y.2.2019-11-26[0].values[4] |
{
"data": {
"state_avg": {
"0": [
{
"groupCols": [],
"isTotal": 1,
"lastValidDateVerticalIndexs": [
"-",
"2",
"1",
"0"
],
"values": [
"-",
0.365,
0.0576,
0.0349,
"-"
]
}
],
"1": [
{
"groupCols": [],
"isTotal": 1,
"lastValidDateVerticalIndexs": [
"-",
"2",
"1",
"0"
],
"values": [
"-",
1,
0.9424,
0.9302,
"-"
]
}
],
"2": [
{
"groupCols": [],
"isTotal": 1,
"lastValidDateVerticalIndexs": [
"-",
"2",
"1",
"0"
],
"values": [
"-",
0,
0,
0,
"-"
]
}
]
},
"x": [
"2019-11-24",
"2019-11-25",
"2019-11-26"
],
"y": {
// 留存
"0": {
"2019-11-24": [
{
"groupCols": [],
"includeToday": true,
"isTotal": 1,
"values": [
172,
62,
10,
6,
2
]
}
],
"2019-11-25": [
{
"groupCols": [],
"includeToday": true,
"isTotal": 1,
"values": [
158,
58,
9,
2,
"-"
]
}
],
"2019-11-26": [
{
"groupCols": [],
"includeToday": true,
"isTotal": 1,
"values": [
81,
30,
5,
"-",
"-"
]
}
]
},
// 流失
"1": {
"2019-11-24": [
{
"groupCols": [],
"includeToday": true,
"isTotal": 1,
"values": [
172,
172,
162,
160,
160
]
}
],
"2019-11-25": [
{
"groupCols": [],
"includeToday": true,
"isTotal": 1,
"values": [
158,
158,
149,
149,
"-"
]
}
],
"2019-11-26": [
{
"groupCols": [],
"includeToday": true,
"isTotal": 1,
"values": [
81,
81,
76,
"-",
"-"
]
}
]
},
// 同时展示
"2": {
"2019-11-24": [
{
"groupCols": [],
"includeToday": true,
"isTotal": 1,
"values": [
0.0,
0.0,
0.0,
0.0,
0.0
]
}
],
"2019-11-25": [
{
"groupCols": [],
"includeToday": true,
"isTotal": 1,
"values": [
0.0,
0.0,
0.0,
0.0,
"-"
]
}
],
"2019-11-26": [
{
"groupCols": [],
"includeToday": true,
"isTotal": 1,
"values": [
0.0,
0.0,
0.0,
"-",
"-"
]
}
]
}
},
"z": [
"player_register",
"obtain_diamond",
"consume_item"
]
},
"return_code": 0,
"return_message": "success"
}
3.3 漏斗分析
[POST /open/funnel-analyze?token=xxxxxxx]
- Request body (application/json)
{ "projectId": 0, "eventView": { "endTime": "2019-11-26 00:00:00", "filts": [ { "columnName": "user_level", "comparator": "equal", "ftv": [ "5" ], "tableType": "user" } ], "groupBy": [ { "columnName": "#country", "tableType": "event" } ], "recentDay": "1-3", "relation": "and", "startTime": "2019-11-24 00:00:00", "windows_gap": 1, "windows_gap_tu": "day" }, "events": [ { "eventName": "obtain_item", "filts": [ { "columnName": "#province", "comparator": "equal", "ftv": [ "江苏省", "上海市" ], "tableType": "event" } ], "relation": "and" }, { "eventName": "consume_item", "filts": [ { "columnName": "#os", "comparator": "equal", "ftv": [ "ios" ], "tableType": "event" } ], "relation": "and" } ], "useCache": true }
- Response body (application/json)
返回内容代表了一张结果表格,表格标题是漏斗步骤。表格内容每行通过了某个步骤后的用户数
分组 | 时间 | 步骤1 | 步骤2 |
---|---|---|---|
y[0].总体 | 阶段合计 | y[0].总体.col1[0] | y[0].总体.col1[1] |
y[0].总体 | x[0] | y[0].总体.col2[0][0] | y[0].总体.col2[0][1] |
y[0].总体 | x[1] | y[0].总体.col2[1][0] | y[0].总体.col2[1][1] |
y[0].总体 | x[2] | y[0].总体.col2[2][0] | y[0].总体.col2[2][1] |
y[1].中国 | 阶段合计 | y[1].总体.col1[0] | y[1].总体.col1[1] |
y[1].中国 | x[0] | y[1].中国.col2[0][0] | y[1].中国.col2[0][1] |
y[1].中国 | x[1] | y[1].中国.col2[1][0] | y[1].中国.col2[1][1] |
y[1].中国 | x[2] | y[1].中国.col2[2][0] | y[1].中国.col2[2][1] |
{
"data": {
"x": [
"2019-11-24",
"2019-11-25",
"2019-11-26"
],
"y": [
{
"总体": {
"col1": [
14,
3
],
"col2": [
[
6,
1
],
[
6,
0
],
[
4,
2
],
[
0,
0
]
]
}
},
{
"中国": {
"col1": [
14,
3
],
"col2": [
[
6,
1
],
[
6,
0
],
[
4,
2
],
[
0,
0
]
]
}
}
],
"z": [
"obtain_item",
"consume_item"
]
},
"return_code": 0,
"return_message": "success"
}
3.4 分布分析
[POST /open/distribution-analyze?token=xxxxxxx]
Request body (application/json)
{ "projectId": 0, "events": [{ "analysis": "AVG", "eventName": "ta@v_test", "filts": [ { "columnName": "#ip", "comparator": "equal", "ftv": [ "159.226.30.7" ], "tableType": "event" } ], "intervalType": "user_defined", "quota": "#vp@strlenchannelname", "quotaIntervalArr": [ 3, 6 ], "relation": "and" }], "eventView": { "endTime": "2019-11-26 00:00:00", "groupBy": [ { "columnName": "#province", "tableType": "event" } ], "startTime": "2019-11-24 00:00:00", "timeParticleSize": "week" }, "useCache": true }
关键参数说明:
- analysis: 分布分析增加三种分析类型:
- TIMES: 次数
- NUMBER_OF_DAYS: 天数
- NUMBER_OF_HOURS: 小时数
- analysis: 分布分析增加三种分析类型:
Response body (application/json)
返回内容代表了一张结果表格,表格标题是分布区间,表格内容每行代表了一段时间在某个分组的分布人数。
时间 | 分组 | 总人数 | distribution_interval[0] | distribution_interval[1] | distribution_interval[2] |
---|---|---|---|---|---|
y.2019-11-18 | y.2019-11-18[0].groupCols | y.2019-11-18[0].totalUserNum | y.2019-11-18[0].values[0] | y.2019-11-18[0].values[1] | y.2019-11-18[0].values[2] |
y.2019-11-18 | y.2019-11-18[1].groupCols | y.2019-11-18[1].totalUserNum | y.2019-11-18[1].values[0] | y.2019-11-18[1].values[1] | y.2019-11-18[1].values[2] |
y.2019-11-25 | y.2019-11-25[0].groupCols | y.2019-11-25[0].totalUserNum | y.2019-11-25[0].values[0] | y.2019-11-25[0].values[1] | y.2019-11-25[0].values[2] |
y.2019-11-25 | y.2019-11-25[1].groupCols | y.2019-11-25[1].totalUserNum | y.2019-11-25[1].values[0] | y.2019-11-25[1].values[1] | y.2019-11-25[1].values[2] |
{
"data": {
"distribution_interval": [
",3",
"3,6",
"6,"
]
"x": [
"2019-11-18",
"2019-11-25"
],
"y": {
"2019-11-18": [
{
"groupCols": [
null
],
"isTotal": 1,
"totalUserNum": 1,
"values": [
0,
1,
0
]
},
{
"groupCols": [
"北京市"
],
"isTotal": 0,
"totalUserNum": 1,
"values": [
0,
1,
0
]
}
],
"2019-11-25": [
{
"groupCols": [
null
],
"isTotal": 1,
"totalUserNum": 1,
"values": [
0,
1,
0
]
},
{
"groupCols": [
"北京市"
],
"isTotal": 0,
"totalUserNum": 1,
"values": [
0,
1,
0
]
}
]
}
},
"return_code": 0,
"return_message": "success"
}
3.5 路径分析
[POST /open/path-analyze?token=xxxxxxx]
- Request body (application/json)
{ "projectId": 0, "events": { "by_fields": [ { "event_name": "consume_item", "field": "#country", "table_type": "event" } ], "event_names": [ "consume_item", "player_logout", "player_register" ], "source_event": { "event_name": "consume_item", "filter": { "filts": [ { "columnName": "#os", "comparator": "equal", "ftv": [ "ios" ], "tableType": "event" } ], "relation": "and" } }, // 起始事件是initial_event, 结束事件是termination_event "source_type": "initial_event", "user_filter": { "filts": [ { "columnName": "user_level", "comparator": "equal", "ftv": [ "9" ], "tableType": "user" } ], "relation": "and" } }, "eventView": { "col_limit": 10, "from_date": "2019-11-20 00:00:00", "recent_day": "1-7", "session_interval": 22, "session_type": "minute", "to_date": "2019-11-26 00:00:00" }, "useCache": true }
Response body (application/json)
{ "data": { "nodes": [ [ { "times": 6, "by_value": "中国", "event_name": "consume_item", "id": "0_中国^_^consume_item" } ], [ { "times": 4, "by_value": "中国", "event_name": "consume_item", "id": "1_中国^_^consume_item" } ], [ { "times": 3, "by_value": "中国", "event_name": "consume_item", "id": "2_中国^_^consume_item" } ], [ { "times": 3, "by_value": "中国", "event_name": "consume_item", "id": "3_中国^_^consume_item" } ], [ { "times": 2, "by_value": "中国", "event_name": "consume_item", "id": "4_中国^_^consume_item" } ], [ { "times": 2, "by_value": "中国", "event_name": "consume_item", "id": "5_中国^_^consume_item" } ], [ { "times": 2, "by_value": "中国", "event_name": "consume_item", "id": "6_中国^_^consume_item" } ], [ { "times": 1, "by_value": "中国", "event_name": "consume_item", "id": "7_中国^_^consume_item" } ], [ { "times": 1, "by_value": "中国", "event_name": "consume_item", "id": "8_中国^_^consume_item" } ], [ { "times": 1, "by_value": "中国", "event_name": "consume_item", "id": "9_中国^_^consume_item" } ] ], "links": [ [ { "times": 4, "source": "0_中国^_^consume_item", "target": "1_中国^_^consume_item" }, { "times": 2, "source": "0_中国^_^consume_item", "is_wastage": true, "target": "1_wastage" } ], [ { "times": 3, "source": "1_中国^_^consume_item", "target": "2_中国^_^consume_item" }, { "times": 1, "source": "1_中国^_^consume_item", "is_wastage": true, "target": "2_wastage" } ], [ { "times": 3, "source": "2_中国^_^consume_item", "target": "3_中国^_^consume_item" } ], [ { "times": 2, "source": "3_中国^_^consume_item", "target": "4_中国^_^consume_item" }, { "times": 1, "source": "3_中国^_^consume_item", "is_wastage": true, "target": "4_wastage" } ], [ { "times": 2, "source": "4_中国^_^consume_item", "target": "5_中国^_^consume_item" } ], [ { "times": 2, "source": "5_中国^_^consume_item", "target": "6_中国^_^consume_item" } ], [ { "times": 1, "source": "6_中国^_^consume_item", "target": "7_中国^_^consume_item" }, { "times": 1, "source": "6_中国^_^consume_item", "is_wastage": true, "target": "7_wastage" } ], [ { "times": 1, "source": "7_中国^_^consume_item", "target": "8_中国^_^consume_item" } ], [ { "times": 1, "source": "8_中国^_^consume_item", "target": "9_中国^_^consume_item" } ] ], "event_name_desc_map": { "anyEvent": "任意事件", "consume_item": "消费道具", "player_logout": "用户登出", "player_register": "用户注册" } }, "return_code": 0, "return_message": "success" }
3.6 用户属性分析
[POST /open/user-prop-analyze?token=xxxxxxx]
Request body (application/json)
{ "projectId": 0, "events": [{ "analysis": "AVG", "filts": [ { "columnName": "latest_login_time", "comparator": "relativeCurrentBetween", "ftv": [ "200", "1" ], "tableType": "user" }, { "columnName": "user_level", "comparator": "less", "ftv": [ "6" ], "tableType": "user" } ], "quota": "diamond_num", "relation": "and", "tableType": "user" }], "eventView": { "groupBy": [ { "columnName": "user_level", "tableType": "user" } ] }, "useCache": true }
- Response body (application/json)
返回内容代表了一张结果表格,表格内容每行代表了某个分组的分析结果。
分组 | 分析结果 |
---|---|
data_list[0].group_cols | data_list[0].values |
data_list[1].group_cols | data_list[1].values |
data_list[2].group_cols | data_list[2].values |
data_list[3].group_cols | data_list[3].values |
data_list[4].group_cols | data_list[4].values |
{
"data": {
"display_quota_name": "当前拥有钻石数.均值",
"data_list": [
{
"group_cols": [
"5"
],
"values": 905.762
},
{
"group_cols": [
"4"
],
"values": 869.983
},
{
"group_cols": [
"3"
],
"values": 333.965
},
{
"group_cols": [
"2"
],
"values": 171.515
},
{
"group_cols": [
"1"
],
"values": 153.568
}
],
"group_cols_sorted": [
[
"5",
"4",
"3",
"2",
"1"
]
],
"cols_format_List": [
"string"
],
"group_num": 5
},
"return_code": 0,
"return_message": "success"
}
4. 用户列表查询
用户列表系列接口用于查询某一个特定分析报告中的具体用户列表,请求的大部分参数与分析报告相同,新增的参数会在每个接口里具体说明。
4.1 事件分析用户列表
[POST /open/event-user-list?token=xxxxxxx]
- Request body (application/json)
{ "projectId": 0, "eventView": { "endTime": "2019-11-26 00:00:00", "groupBy": [ { "columnName": "#city", "tableType": "event" } ], "recentDay": "1-3", "startTime": "2019-11-24 00:00:00", "timeParticleSize": "day" }, "events": [ { "analysis": "TRIG_USER_NUM", "eventName": "consume_item", "filts": [ { "columnName": "user_level", "comparator": "equal", "ftv": [ "5" ], "tableType": "user" } ], "quota": "#vp@dailyTask", "relation": "and", "type": "normal" } ], // 事件所在日期 "sliceDate": "2019-11-26", // 事件所在分组 "sliceGroupVal": [ "北京市" ] }
Response body (application/json)
{ "data": { "datalist": [ { "#account_id": "e78107482", "#distinct_id": "e145056682", "user_level": 5, "register_time": "2019-11-26 14:36:13", "diamond_num": 1006, "latest_login_time": "2019-11-26 15:45:16", "channel": "app store", "#user_id": 33474682 }, { "#account_id": "d7819213", "#distinct_id": "d14521393", "user_level": 5, "register_time": "2019-11-26 23:25:14", "diamond_num": 858, "first_recharge_time": "2019-11-26 23:29:56", "latest_login_time": "2019-11-26 23:32:48", "channel": "app store", "#user_id": 3351093 } ], "columMeta": { "#account_id": "账户ID", "#distinct_id": "访客ID", "user_level": "用户等级", "register_time": "注册时间", "diamond_num": "当前拥有钻石数", "first_recharge_time": "首次充值时间", "latest_login_time": "最后登录时间", "channel": "渠道" } }, "return_code": 0, "return_message": "success" }
4.2 留存分析用户列表
[POST /open/retention-user-list?token=xxxxxxx]
Request body (application/json)
{ "projectId": 0, "eventView": { "endTime": "2019-11-26 00:00:00", "groupBy": [ { "columnName": "#province", "tableType": "event" } ], "recentDay": "1-3", "startTime": "2019-11-24 00:00:00", "statType": "retention", "timeParticleSize": "day", "unitNum": 7 }, "events": [ { "eventName": "player_register", "filts": [ { "columnName": "#province", "comparator": "equal", "ftv": [ "江苏省", "上海市" ], "tableType": "event" }, { "columnName": "user_level", "comparator": "greater", "ftv": [ "2" ], "tableType": "user" } ], "relation": "and", "type": "first" }, { "eventName": "obtain_diamond", "filts": [ { "columnName": "#os", "comparator": "equal", "ftv": [ "android" ], "tableType": "event" }, { "$ref": "$.events[0].filts[1]" } ], "relation": "and", "type": "second" } ], "sliceDate": "2019-11-26", // 时段下标: 0:初始事件用户数, 1:当日, 2:1日后, 3:2日后 "sliceInterval": 3 }
Response body (application/json)
{ "data": { "datalist": [ { "#account_id": "v47739399", "#distinct_id": "v88658799", "user_level": 11, "register_time": "2019-11-26 19:13:20", "diamond_num": 1182, "latest_login_time": "2019-11-26 20:16:19", "channel": "华为应用市场", "#user_id": 20459799 }, { "#account_id": "i7819568", "#distinct_id": "i14522048", "user_level": 4, "register_time": "2019-11-26 23:56:17", "diamond_num": 1006, "latest_login_time": "2019-11-26 23:59:59", "channel": "360手机助手", "#user_id": 3351248 }, { "#account_id": "g7812426", "#distinct_id": "g14508786", "user_level": 14, "register_time": "2019-11-26 17:54:13", "diamond_num": 245, "first_recharge_time": "2019-11-26 18:08:58", "latest_login_time": "2019-11-26 20:16:19", "channel": "小米应用商店", "#user_id": 3348186 }, { "#account_id": "a7812000", "#distinct_id": "a14508000", "user_level": 3, "register_time": "2019-11-26 17:27:28", "diamond_num": 1153, "latest_login_time": "2019-11-26 18:45:58", "channel": "app store", "#user_id": 3348000 } ], "columMeta": { "#account_id": "账户ID", "#distinct_id": "访客ID", "user_level": "用户等级", "register_time": "注册时间", "diamond_num": "当前拥有钻石数", "first_recharge_time": "首次充值时间", "latest_login_time": "最后登录时间", "channel": "渠道" } }, "return_code": 0, "return_message": "success" }
4.3 漏斗分析用户列表
[POST /open/funnel-user-list?token=xxxxxxx]
Request body (application/json)
{ "projectId": 0, "eventView": { "endTime": "2019-11-26 00:00:00", "filts": [ { "columnName": "user_level", "comparator": "equal", "ftv": [ "5" ], "tableType": "user" } ], "groupBy": [ { "columnName": "#province", "tableType": "event" } ], "recentDay": "1-4", "relation": "and", "startTime": "2019-11-23 00:00:00", "timeParticleSize": "day" }, "events": [ { "eventName": "obtain_item", "filts": [ { "columnName": "#province", "comparator": "equal", "ftv": [ "江苏省", "上海市" ], "tableType": "event" } ], "relation": "and" } ], // 漏斗步骤, 从1开始 "sliceFunnelStep": 1, "sliceGroupVal": "上海市" }
Response body (application/json)
{ "data": { "datalist": [ { "#account_id": "u78082246", "#distinct_id": "u145009846", "user_level": 5, "register_time": "2019-11-26 09:59:34", "diamond_num": 1006, "latest_login_time": "2019-11-26 11:14:12", "channel": "小米应用商店", "#user_id": 33463846 }, { "#account_id": "k77655236", "#distinct_id": "k144216836", "user_level": 5, "register_time": "2019-11-24 08:53:09", "diamond_num": 1012, "latest_login_time": "2019-11-24 10:02:38", "channel": "豌豆荚", "#user_id": 33280836 }, { "#account_id": "a77648226", "#distinct_id": "a144203826", "user_level": 5, "register_time": "2019-11-24 08:21:19", "diamond_num": 1006, "latest_login_time": "2019-11-24 09:32:31", "channel": "应用宝", "#user_id": 33277826 } ], "columMeta": { "#account_id": "账户ID", "#distinct_id": "访客ID", "user_level": "用户等级", "register_time": "注册时间", "diamond_num": "当前拥有钻石数", "first_recharge_time": "首次充值时间", "latest_login_time": "最后登录时间", "channel": "渠道" } }, "return_code": 0, "return_message": "success" }
4.4 分布分析用户列表
[POST /open/distribution-user-list?token=xxxxxxx]
Request body (application/json)
{ "projectId": 0, "events": [{ "analysis": "TIMES", "eventName": "consume_item", "filts": [ { "columnName": "#os", "comparator": "equal", "ftv": [ "android" ], "tableType": "event" } ], "intervalType": "def", "quota": "", "relation": "and" }], "eventView": { "endTime": "2019-11-26 00:00:00", "groupBy": [ { "columnName": "#province", "tableType": "event" } ], "recentDay": "D31", "startTime": "2019-10-28 00:00:00", "timeParticleSize": "week" }, // [10,20)小时 "interval": "10,20", // 2019-11-18当周 "sliceDate": "2019-11-18", "sliceGroupVal": [ "北京市" ] }
Response body (application/json)
{ "data": { "datalist": [ { "#account_id": "h7784497", "#distinct_id": "h14456917", "user_level": 13, "register_time": "2019-11-24 21:52:38", "diamond_num": 1201, "latest_login_time": "2019-11-24 23:35:49", "channel": "百度手机助手", "#user_id": 3336217 }, { "#account_id": "h6201359", "#distinct_id": "h11516759", "user_level": 68, "register_time": "2019-06-23 09:25:18", "diamond_num": 1686, "first_recharge_time": "2019-06-23 09:25:38", "latest_login_time": "2019-11-18 23:01:49", "channel": "华为应用市场", "#user_id": 2657759 }, { "#account_id": "g4102426", "#distinct_id": "g7618786", "user_level": 47, "register_time": "2019-07-29 13:58:23", "diamond_num": 1, "first_recharge_time": "2019-07-29 15:42:20", "latest_login_time": "2019-11-24 16:04:03", "channel": "应用宝", "#user_id": 1758186 } ], "columMeta": { "#account_id": "账户ID", "#distinct_id": "访客ID", "user_level": "用户等级", "register_time": "注册时间", "diamond_num": "当前拥有钻石数", "first_recharge_time": "首次充值时间", "latest_login_time": "最后登录时间", "channel": "渠道" } }, "return_code": 0, "return_message": "success" }
4.5 路径分析用户列表
[POST /open/path-user-list?token=xxxxxxx]
Request body (application/json)
{ "projectId": 0, "events": { "event_names": [ "obtain_item", "consume_item", "obtain_coin" ], "source_event": { "event_name": "consume_item", "filter": { "filts": [ { "columnName": "#os", "comparator": "equal", "ftv": [ "ios" ], "tableType": "event" } ], "relation": "and" } }, "source_type": "initial_event", "user_filter": { "filts": [ { "columnName": "user_level", "comparator": "equal", "ftv": [ "6" ], "tableType": "user" } ], "relation": "and" } }, "eventView": { "col_limit": 10, "from_date": "2019-11-20 00:00:00", "recent_day": "1-7", "session_interval": 22, "session_type": "minute", "to_date": "2019-11-26 00:00:00" }, "next_slice_event_by_values": [ { "slice_event_name": "obtain_coin" } ], // 当前所处的路径层级(从0开始计数) "session_level": 2, // total 合计; with_next 后续有节点; without_next 后续没有节点; with_next_specific:后续有某个事件的节点 "slice_type": "with_next_specific", // slice_type=with_next_specific时必须传 "slice_event_by_values": [ { "slice_event_name": "obtain_item" } ] }
Response body (application/json)
{ "data": { "datalist": [ { "#account_id": "j77444535", "#distinct_id": "j143825535", "user_level": 6, "register_time": "2019-11-22 17:07:12", "diamond_num": 1270, "latest_login_time": "2019-11-22 18:23:19", "channel": "app store", "#user_id": 33190535 } ], "total_num": 1, "columMeta": { "#account_id": "账户ID", "#distinct_id": "访客ID", "user_level": "用户等级", "register_time": "注册时间", "diamond_num": "当前拥有钻石数", "first_recharge_time": "首次充值时间", "latest_login_time": "最后登录时间", "channel": "渠道" } }, "return_code": 0, "return_message": "success" }
4.6 用户属性分析用户列表
[POST /open/user-prop-user-list?token=xxxxxxx]
Request body (application/json)
{ "projectId": 0, "events": [{ "analysis": "AVG", "filts": [ { "columnName": "latest_login_time", "comparator": "relativeCurrentBetween", "ftv": [ "7", "1" ], "tableType": "user" } ], "quota": "diamond_num", "relation": "and", "tableType": "user" }], "eventView": { "groupBy": [ { "columnName": "user_level", "tableType": "user" }, { "columnName": "channel", "tableType": "user" } ] }, "sliceGroupVal": [ "31", "app store" ] }
Response body (application/json)
{ "data": { "datalist": [ { "#account_id": "b6909071", "#distinct_id": "b12831131", "user_level": 31, "register_time": "2019-09-23 09:33:31", "diamond_num": 1250, "first_recharge_time": "2019-11-18 08:50:33", "latest_login_time": "2019-11-26 18:15:51", "channel": "app store", "#user_id": 2961031 }, { "#account_id": "a6013000", "#distinct_id": "a11167000", "user_level": 31, "register_time": "2019-09-02 19:15:08", "diamond_num": 72, "first_recharge_time": "2019-09-02 19:18:36", "latest_login_time": "2019-11-24 10:02:38", "channel": "app store", "#user_id": 2577000 }, { "#account_id": "j2614535", "#distinct_id": "j4855535", "user_level": 31, "register_time": "2019-08-24 20:40:19", "diamond_num": 820, "latest_login_time": "2019-11-21 14:16:42", "channel": "app store", "#user_id": 1120535 } ], "columMeta": { "#account_id": "账户ID", "#distinct_id": "访客ID", "user_level": "用户等级", "register_time": "注册时间", "diamond_num": "当前拥有钻石数", "first_recharge_time": "首次充值时间", "latest_login_time": "最后登录时间", "channel": "渠道" } }, "return_code": 0, "return_message": "success" }
5. 用户事件列表查询
[POST /open/user-event-list?token=xxxxxxx]
Request body (application/json)
{ "eventNames": [ "ta_app_start", "ta_app_view", "use_item", "recharge", "participate_quest", "participate_activity" ], "pagerHeader": { "pageNum": 1, "pageSize": 30 }, "projectId": 0, "startDateTime": "2019-11-22 00:00:00", // 查询从开始时间到之后一周以内的,取值 minute/hour/day/week/month/total "dateFormat": "week", "userId": 33171371 }
- Response body (application/json)
{ "data": { "userEventSeqList": [ { "event_name": "use_item", "time": "2019-11-22 00:03:17", "properties": { "#ip": "59.71.165.109", "#country": "中国", "#province": "湖北省", "#city": "武汉市", "#manufacturer": "iphone", "#os": "ios", "#device_id": "200ECB2114238E4ECCACBFE4D7D88343", "#screen_height": 1920, "#device_model": "iphone6sp", "#app_version": "7.12.2", "#screen_width": 1080, "#lib": "ios", "#network_type": "4G", "#carrier": "中国移动", "server_id": "43", "channel": "app store" } }, { "event_name": "use_item", "time": "2019-11-22 00:03:20", "properties": { "#ip": "59.71.165.109", "#country": "中国", "#province": "湖北省", "#city": "武汉市", "#manufacturer": "iphone", "#os": "ios", "#device_id": "200ECB2114238E4ECCACBFE4D7D88343", "#screen_height": 1920, "#device_model": "iphone6sp", "#app_version": "7.12.2", "#screen_width": 1080, "#lib": "ios", "#network_type": "4G", "#carrier": "中国移动", "server_id": "43", "channel": "app store" } }, { "event_name": "use_item", "time": "2019-11-22 00:03:28", "properties": { "#ip": "59.71.165.109", "#country": "中国", "#province": "湖北省", "#city": "武汉市", "#manufacturer": "iphone", "#os": "ios", "#device_id": "200ECB2114238E4ECCACBFE4D7D88343", "#screen_height": 1920, "#device_model": "iphone6sp", "#app_version": "7.12.2", "#screen_width": 1080, "#lib": "ios", "#network_type": "4G", "#carrier": "中国移动", "server_id": "43", "channel": "app store" } }, { "event_name": "use_item", "time": "2019-11-22 11:35:04", "properties": { "#ip": "59.71.165.109", "#country": "中国", "#province": "湖北省", "#city": "武汉市", "#manufacturer": "iphone", "#os": "ios", "#device_id": "200ECB2114238E4ECCACBFE4D7D88343", "#screen_height": 1920, "#device_model": "iphone6sp", "#app_version": "7.12.2", "#screen_width": 1080, "#lib": "ios", "#network_type": "4G", "#carrier": "中国移动", "server_id": "43", "channel": "app store" } } ], "eventNameDescMeta": { "anyEvent": "任意事件", "participate_activity": "参与活动", "participate_quest": "参与任务", "recharge": "充值", "ta_app_start": "ta_app_start", "ta_app_view": "ta_app_view", "use_item": "使用道具" }, "columnDescMeta": { "#ip": "客户端IP", "#country": "国家", "#province": "省份", "#city": "城市", "#manufacturer": "生产商", "#os": "操作系统", "#device_id": "设备号", "#screen_height": "屏幕高度", "#device_model": "设备型号", "#app_version": "app版本", "#screen_width": "屏幕宽度", "#lib": "系统库", "#network_type": "网络类型", "#carrier": "运营商", "server_id": "服务器", "channel": "渠道1", "diamond_obtain": "充值获得钻石数", "recharge_level": "充值等级", "recharge_value": "充值金额", "activity_type": "活动类型", "activity_item_operation": "活动项目", "recharge_first_day": "是否首日充值", "recharge_first_time": "是否首次充值", "quest_type": "任务类型", "quest_name": "任务名称" } }, "return_code": 0, "return_message": "success" }