统计数据导出 API

注意:

  • 本页 API 中的 project_id、dashboard_id、chart_id 字段,均可在项目页面url中找到,如:"https://www.growingio.com/admin/projects/nxog09md/dashboard/YoX28w7R" 中的 "nxog09md" 和 "YoX28w7R" 分别是 project_id 和dashboard_id。

  • 在进行导出之前,请务必参考“GrowingIO接口认证”文档,完成接口认证获取 token 。

  • 统计数据导出的延迟一般为 30 分钟,比如导出早上 8 点到 9 点之间的数据时,一般需要 9:30 才能统计完毕。另外,每天凌晨因为需要运行天级别的统计任务,此时前一天的统计数据大概有 3-4 小时的延迟,一般凌晨 4 点以后会统计完毕。

1.看板数据信息 API

1.1 获取看板列表

get

https://www.growingio.com/projects/:project_id/dashboards.json
获取当前项目下全部看板列表,按更新时间由近到远排序
Request
Response
Path Parameters
project_id
required
string
项目 uid
Headers
X-Client-Id
required
string
GrowingIO 分配的公钥,见 API 认证文档
Authorization
required
string
认证 Token,见 API 认证文档
200: OK
[
{
"id": "Dashboard Uid",
"name": "我的看板",
"type": "看板类型", // normal: 普通看板, realtimeV2: 实时看板
"createdAt": "2019-01-01",
"updatedAt": "2019-01-02",
"scope": "看板所属", // global: 全局, project: 项目, user: 个人
"updater": "Dashboard Last Updator",
"creator": "Dashboard Creator"
},
...
]

1.2 获取看板中的图表信息

get

https://www.growingio.com/projects/:project_id/dashboards/:dashboard_id.json
Request
Response
Path Parameters
dashboard_id
required
string
看板 id
project_id
required
string
项目 uid
Headers
Authorization
required
string
认证 Token,见 API 认证文档
X-Client-Id
required
string
GrowingIO 分配的公钥,见 API 认证文档
200: OK
{
"id": "Dashboard Uid",
"name": "Dashboard Name",
"charts": [
{
"id": "Chart Uid",
"name": "Chart Name",
"createor": "Chart Creator",
"createdAt": "Created Time"
},
{
"id": "Chart Uid",
"name": "Chart Name",
"createor": "Chart Creator",
"createdAt": "Created Time"
}
]
}

2.事件分析下载 API V2(2018-08-29更新)

获取事件分析数据(单图下载每秒限速 2 次)

get

https://www.growingio.com/v2/projects/:project_id/charts/:chart_id.json
Request
Response
Path Parameters
chart_id
required
string
事件分析(单图 ID)
project_id
required
string
项目 uid
Headers
Authorization
required
string
认证 Token,见 API 认证文档
X-Client-Id
required
string
GrowingIO 分配的公钥,见 API 认证文档
Query Parameters
interval
optional
integer
数据粒度,3600000(小时),86400000(天),604800000(周), 2592000000(月),默认为天
endTime
required
integer
数据结束时间,unix 毫秒时间戳
startTime
required
integer
数据起始时间,unix 毫秒时间戳
200: OK
{
"id": "Chart Uid",
"name": "Chart Name",
"startTime": 1462118400000,
"endTime": 1462118400000,
"interval": 86400000,
"aggregator": { // 当大数字图时返回该字段
"values": [
27557, // 本周期聚合值
25409 // 上周期聚合值
]
}
"meta": [
{ "name": "目标用户", "dimension": true},
{ "name": "城市", "dimension": true },
{ "name": "浏览器", "dimension": true },
{ "name": "Metric 1", "metric": true },
{ "name": "Metric 2", "metric": true }
],
"data": [
// 线图
[目标用户, timestamp, metric1, metric2],
[目标用户, timestamp, metric1, metric2]
// 横向柱图
[目标用户, dimension_v1, metric1],
[目标用户, dimension_v2, metric1]
// 纵向柱图
[目标用户, timestamp, metric1, metrics2],
[目标用户, timestamp, metric1, metrics2]
// 表格
[目标用户, dimension1_v1, dimension2_v1, metric1, metric2],
[目标用户, dimension1_v2, dimension2_v1, metric1, metric2]
// 大数字
[目标用户, timestamp, metric1]
// 气泡图
[目标用户, dimension1_v1, dimension2_v1, metric1, metric2]
]
}

3.分群下载 API

3.1 获取分群列表

get

https://www.growingio.com/projects/:project_id/segmentations.json
Request
Response
Path Parameters
project_id
required
string
项目 uid
Headers
Authorization
required
string
认证 Token,见 API 认证文档
X-Client-Id
required
string
GrowingIO 分配的公钥,见 API 认证文档
200: OK
[
{
"id": "Segmentation Uid",
"name": "Segmentation Name",
"userType": 'u',
"userNum": 1230,
"updatedAt": "2016-08-03"
},
{
"id": "Segmentation Uid",
"name": "Segmentation Name",
"userType": 'cs1',
"userNum": 1230,
"updatedAt": "2016-08-03"
},
...
]

3.2 获取特定分群的用户列表

get

https://www.growingio.com/projects/:project_id/segmentations/:segmentation_id/users.csv
Request
Response
Path Parameters
segmentation_id
required
string
分群 id
project_id
required
string
项目 uid
Headers
Authorization
required
string
认证 Token,见 API 认证文档
X-Client-Id
required
string
GrowingIO 分配的公钥,见 API 认证文档
200: OK
以 Tab 分割的 csv 文件,内容为上传的用户属性
cs1 name
12249 GrowingIO

4.规则逻辑 API 接口

获取圈选元素定义

get

https://www.growingio.com/projects/:project_id/rules.csv
Request
Response
Path Parameters
project_id
required
string
项目 uid
Headers
Authorization
required
string
认证 Token,见 API 认证文档
X-Client-Id
required
string
GrowingIO 分配的公钥,见 API 认证文档
200: OK
以 Tab 分割的 csv 文件
ruleId,eventName,eventType
f2503720,元素_注册按钮,clck
401: Unauthorized
{
"message": "Unauthorized",
"errors": []
}
500: Internal Server Error
{
"message": "Request timeout",
"errors": [
{
"code": "request_timeout",
"message": "Request timeout in 5000 milliseconds"
}
]
}