导出报表数据——留存分析
1.新增用户数据
POST _SJK_API_PATH_/api-v2/retention/calculate_new
请求参数:
字段 | 格式 | 说明 | 是否必需 | 示例 | |
---|---|---|---|---|---|
access_token | string | 通过oauth认证获取的token | 是 | ||
platform_id | int | 平台id | 否 | web:1 H5:2 IOS:3 Android:4 微信小程序:5 | |
retention_id | int | 自定义留存id | 是 | 通过base/retentions接口获取 | |
predicates | array | 筛选条件 | 否 | predicates[0][values][]=搜索引擎&predicates[0][op]=eq&predicates[0][name]=channel_type 即为筛选访问渠道类型等于搜索引擎的数据。其中op操作符可能出现的值:eq / ne / gt / ge / lt / le / like / nlike / between / null / not null |
|
dimensions | array | 维度(即属性),用于分组查询 | 否 | 数据通过 base/attrs接口获取 dimensions[]=channel 即为按访问渠道名称分组 |
|
relation | string | 多个筛选条件(predicates)之间的关系 | 是 | 可能出现的值:and / or 若筛选条件不足2个,默认and | |
granularity | string | 查询的时间粒度 | 是 | 可能出现的值:month / week / day | |
time_range | array | 查询的时间范围 | 是 | time_range[]=2019-08-06&time_range[]=2019-08-12 需要有起始时间和结束时间2个值且结束时间不能小于起始时间 |
调用示例:
curl -d 'access_token=_TOKEN_&retention_id=10&dimensions[]=channel&relation=and&granularity=day&time_range[]=2019-08-05&time_range[]=2019-08-11' https://a.geekdata.com/api-v2/retention/calculate_new
Response:
{
"status": 0,
"msg": {
"msg": "success",
"desc": ""
},
"data": [
[
"2019-08-05",
"\u767e\u5ea6\u641c\u7d22",
451
],
[
"2019-08-05",
"www.5688.com.cn",
1
],
[
"2019-08-06",
"wap.sogou.com",
1
],
[
"2019-08-06",
"\u767e\u5ea6\u641c\u7d22",
521
],
[
"2019-08-07",
"\u65b0\u6d6a\u535a\u5ba2",
1
],
[
"2019-08-07",
"www.moodao.com",
1
],
[
"2019-08-08",
"\u767e\u5ea6\u641c\u7d22",
365
],
[
"2019-08-09",
"huaban.com",
1
],
[
"2019-08-10",
"\u767e\u5ea6\u624b\u673a\u7248",
180
],
[
"2019-08-11",
"BING",
24
]
]
}
字段介绍:[时间,维度,新增用户数]
2.后续留存用户数据
POST _SJK_API_PATH_/api-v2/retention/calculate_retention
请求参数:同retention/calculate_new
调用示例:
curl -d 'access_token=_TOKEN_&retention_id=10&dimensions[]=channel&relation=and&granularity=day&time_range[]=2019-08-05&time_range[]=2019-08-11' https://a.geekdata.com/api-v2/retention/calculate_retention
Response:
{
"status": 0,
"msg": {
"msg": "success",
"desc": ""
},
"data": [
[
"2019-08-05",
"GOOGLE",
"2019-08-09",
2
],
[
"2019-08-05",
"\u767e\u5ea6\u624b\u673a\u7248",
"2019-08-05",
4
],
[
"2019-08-06",
"\u7b80\u4e66",
"2019-08-06",
1
],
[
"2019-08-06",
"\u767e\u5ea6\u641c\u7d22",
"2019-08-09",
2
],
[
"2019-08-06",
"GOOGLE",
"2019-08-06",
3
],
[
"2019-08-07",
"\u767e\u5ea6\u641c\u7d22",
"2019-08-08",
5
],
[
"2019-08-07",
"GOOGLE",
"2019-08-12",
1
],
[
"2019-08-08",
"GOOGLE",
"2019-08-08",
1
],
[
"2019-08-08",
"\u5fae\u4fe1\u597d\u53cb\u5206\u4eab",
"2019-08-09",
1
],
[
"2019-08-09",
"\u767e\u5ea6\u641c\u7d22",
"2019-08-12",
2
],
[
"2019-08-09",
"\u767e\u5ea6\u641c\u7d22",
"2019-08-09",
11
],
[
"2019-08-10",
"GOOGLE",
"2019-08-11",
1
],
[
"2019-08-10",
"\u767e\u5ea6\u624b\u673a\u7248",
"2019-08-10",
3
],
[
"2019-08-11",
"\u767e\u5ea6\u641c\u7d22",
"2019-08-12",
2
]
]
}
字段介绍:[作为新增用户出现时间,维度,再次访问时间,再次访问用户数]
3.新增用户明细
POST _SJK_API_PATH_/api-v2/retention/new_detail
请求参数:
字段 | 格式 | 说明 | 是否必需 | 示例 | |
---|---|---|---|---|---|
access_token | string | 通过oauth认证获取的token | 是 | ||
platform_id | int | 平台id | 否 | web:1 H5:2 IOS:3 Android:4 微信小程序:5 | |
retention_id | int | 自定义留存id | 是 | 通过base/retentions接口获取 | |
predicates | array | 筛选条件 | 否 | predicates[0][values][]=搜索引擎&predicates[0][op]=eq&predicates[0][name]=channel_type 即为筛选访问渠道类型等于搜索引擎的数据。其中op操作符可能出现的值:eq / ne / gt / ge / lt / le / like / nlike / between / null / not null |
|
dimensions | array | 维度(即属性),用于分组查询 | 否 | 数据通过 base/attrs接口获取 dimensions[]=channel 即为按访问渠道名称分组 |
|
relation | string | 多个筛选条件(predicates)之间的关系 | 是 | 可能出现的值:and / or 若筛选条件不足2个,默认and | |
granularity | string | 查询的时间粒度 | 是 | 可能出现的值:month / week / day | |
time_range | array | 查询的时间范围 | 是 | time_range[]=2019-08-06&time_range[]=2019-08-12 需要有起始时间和结束时间2个值且结束时间不能小于起始时间 |
|
predicates2 | array | 具体查询明细的时间和维度条件 | 是 | predicates2[0][name]=channel&predicates2[0][op]=eq&predicates2[0][values][]=BING&predicates2[1][name]=dd&predicates2[1][op]=eq&predicates2[1][values][]=2019-08-12 必须由时间维度和所选的dimensions的具体值组成限定条件 |
调用示例:
curl -d 'access_token=_TOKEN_&retention_id=10&dimensions[]=channel&predicates2[0][name]=channel&predicates2[0][op]=eq&predicates2[0][values][]=简书&predicates2[1][name]=dd&predicates2[1][op]=eq&predicates2[1][values][]=2019-08-05&relation=and&granularity=day&time_range[]=2019-08-05&time_range[]=2019-08-11' https://a.geekdata.com/api-v2/retention/new_detail
Response:
{
"status": 0,
"msg": {
"msg": "success",
"desc": ""
},
"data": [
[
"1f466c2a2316f209",
"-",
"2019-08-05 12:54:00",
"\u65b0\u8bbf\u5ba2",
"\u672a\u6ce8\u518c\u7528\u6237",
"\u5916\u94fe",
"\u7b80\u4e66",
"\u6d59\u6c5f",
"-"
],
[
"1f466c2a2316f209",
"-",
"2019-08-05 12:53:00",
"\u65b0\u8bbf\u5ba2",
"\u672a\u6ce8\u518c\u7528\u6237",
"\u5916\u94fe",
"\u7b80\u4e66",
"\u6d59\u6c5f",
"-"
],
[
"1f466c2a2316f209",
"-",
"2019-08-05 12:52:00",
"\u65b0\u8bbf\u5ba2",
"\u672a\u6ce8\u518c\u7528\u6237",
"\u5916\u94fe",
"\u7b80\u4e66",
"\u6d59\u6c5f",
"-"
],
[
"1f466c2a2316f209",
"-",
"2019-08-05 12:51:00",
"\u65b0\u8bbf\u5ba2",
"\u672a\u6ce8\u518c\u7528\u6237",
"\u5916\u94fe",
"\u7b80\u4e66",
"\u6d59\u6c5f",
"-"
],
[
"b4dc48f92156fa3c",
"-",
"2019-08-05 14:42:00",
"\u65b0\u8bbf\u5ba2",
"\u672a\u6ce8\u518c\u7528\u6237",
"\u5916\u94fe",
"\u7b80\u4e66",
"\u5317\u4eac",
"\u5317\u4eac"
]
]
}
字段含义 [[GeekDataID,用户ID,最近访问时间,访客类型,注册类型,渠道类型,渠道名称,所在省份,所在城市]..]
4.留存用户明细
POST _SJK_API_PATH_/api-v2/retention/retention_detail
请求参数:同retention/new_detail 接口
调用示例:
curl -d 'access_token=_TOKEN_&retention_id=10&dimensions[]=channel&predicates2[0][name]=channel&predicates2[0][op]=eq&predicates2[0][values][]=百度手机版&predicates2[1][name]=first_dd&predicates2[1][op]=eq&predicates2[1][values][]=2019-08-05&predicates2[2][name]=dd&predicates2[2][op]=eq&predicates2[2][values][]=2019-08-06&relation=and&granularity=day&time_range[]=2019-08-05&time_range[]=2019-08-11' https://a.geekdata.com/api-v2/retention/retention_detail
Response:
{
"status": 0,
"msg": {
"msg": "success",
"desc": ""
},
"data": [
[
"75370fc6a04cfe7c",
"-",
"2019-08-06 11:28:00",
"\u56de\u8bbf\u8bbf\u5ba2",
"\u672a\u6ce8\u518c\u7528\u6237",
"\u641c\u7d22\u5f15\u64ce",
"\u767e\u5ea6\u624b\u673a\u7248",
"\u5e7f\u4e1c",
"\u6df1\u5733"
],
[
"8380914874464e53",
"-",
"2019-08-06 00:35:00",
"\u56de\u8bbf\u8bbf\u5ba2",
"\u672a\u6ce8\u518c\u7528\u6237",
"\u641c\u7d22\u5f15\u64ce",
"\u767e\u5ea6\u624b\u673a\u7248",
"\u6e56\u5357",
"\u957f\u6c99"
]
]
}
字段含义 [[GeekDataID,用户ID,最近访问时间,访客类型,注册类型,渠道类型,渠道名称,所在省份,所在城市]..]