多维归因(同类对比)
1. 接口描述
多维归因-同类对比接口用于在同一时间范围内,对两个“同类对象”进行归因分析对比。例如:
-
杭州店 vs 南京店
-
华东大区 vs 华南大区
-
自营渠道 vs 代理渠道
通过指定:
-
对比指标
-
参与分析的维度(如 channel)
-
对比对象所属维度(如 store)
-
当前对象与对比对象的过滤条件与时间范围
接口会返回:
-
当前对象与对比对象的指标值
-
增长值、增长率
-
各维度组合下的整体贡献率、相对贡献率等。
2. 接口 URL
3. 公共请求参数(HEADERS)
| 参数名 | 类型 | 是否必选 | 最大长度 | 描述 |
|---|---|---|---|---|
| tenant-id | String | 是 | 32 | 租户 ID,用于指定指标所在的业务空间 |
| auth-type | String | 是 | 32 | 认证方式:UID(用户)或 TOKEN(令牌) |
| auth-value | String | 是 | 32 | 与 auth-type 对应的认证值 |
公共参数获取方式
在 Aloudata CAN 顶部导航选择「指标应用」,左侧菜单进入「API 集成」页面,获取 tenant-id 和 auth-value。

4. 请求参数
4.1 Body 总体结构
| 字段名 | 类型 | 是否必选 | 描述 |
|---|---|---|---|
| metric | String | 是 | 参与归因分析的指标名称(可为临时指标名) |
| metricDefinitions | Map |
否 | 临时指标定义(如对原始指标加 filters) |
| dimensions | Array |
是 | 参与归因的维度列表,例如 ["channel"] |
| attribution | Object | 是 | 归因分析相关配置(对比方式、对象、时间范围等) |
4.2 metricDefinitions 结构(可选)
若使用临时指标(例如对原始指标增加区域过滤),可通过 metricDefinitions 定义:
| 字段名 | 类型 | 描述 |
|---|---|---|
| refMetric | String | 被引用的原始指标 code |
| filters | Array | 作用在该临时指标上的过滤条件表达式 |
示例:
"metricDefinitions": {
"order_count_temp1": {
"refMetric": "order_count",
"filters": [
"IN([province],\"浙江\",\"江苏\")"
]
}
}
4.3 attribution 结构(必选)
| 字段名 | 类型 | 是否必选 | 描述 |
|---|---|---|---|
| attributionCalculateType | String | 是 | 归因计算方式:AVG(均值),未来可扩展 |
| compareDimension | String | 是 | 对比对象所属的维度,如 "store"、"province" |
| filters | Array | 否 | 作用于整体(currentObject + compareObject)的全局过滤条件 |
| timeConstraint | String | 否 | 对整体的时间过滤条件(一般留空,分别在 currentObject / compareObject 中指定) |
| currentObject | Object | 是 | 当前对象配置(过滤条件 + 时间范围) |
| compareObject | Object | 是 | 对比对象配置(过滤条件 + 时间范围) |
currentObject / compareObject 结构相同:
| 字段名 | 类型 | 是否必选 | 描述 |
|---|---|---|---|
| filters | Array | 是 | 当前/对比对象的过滤条件(如某门店、某区域) |
| timeConstraint | String | 是 | 当前/对比对象的时间范围表达式 |
4.4 请求示例
{
"metric": "order_count_temp1",
"metricDefinitions": {
"order_count_temp1": {
"refMetric": "order_count",
"filters": [
"IN([province],\"浙江\",\"江苏\")"
]
}
},
"dimensions": [
"channel"
],
"attribution": {
"attributionCalculateType": "AVG",
"compareDimension": "store",
"filters": [],
"timeConstraint": "",
"currentObject": {
"filters": [
"[store]=\"杭州店\""
],
"timeConstraint": "[metric_time__day]=\"2025-07-07\""
},
"compareObject": {
"filters": [
"[store]=\"南京店\""
],
"timeConstraint": "[metric_time__day]=\"2025-07-06\""
}
}
}
说明:
5. 响应参数
5.1 顶层结构
| 字段名 | 类型 | 描述 |
|---|---|---|
| tables | Array | 多个“维度组合 + 归因表”的列表 |
每个元素结构如下:
| 字段名 | 类型 | 描述 |
|---|---|---|
| dimensions | String | 当前归因数据对应的维度组合;为空字符串表示总体汇总 |
| table | Object | 当前维度组合下的归因结果表 |
5.2 table 内部字段定义
| 字段名 | 类型 | 描述 |
|---|---|---|
| <各维度字段名> | Array | 每个维度的值列表,如 "channel": ["线上","线下"] |
| @currentValue | Array |
当前对象的指标值 |
| @compareValue | Array |
对比对象的指标值 |
| @growth | Array |
增长值(当前值 - 对比值) |
| @growthRate | Array |
增长率((当前值 - 对比值) / 对比值) |
| @overallContributionRate | Array |
整体贡献率 |
| @relativeContributionRate | Array |
相对贡献率(可为空) |
5.3 响应示例
{
"tables": [
{
"dimensions": "channel",
"table": {
"channel": [
"线上",
"线下"
],
"@currentValue": [
100,
200
],
"@compareValue": [
80,
130
],
"@growth": [
20,
70
],
"@growthRate": [
0.2,
0.35
],
"@overallContributionRate": [
0.3,
0.7
],
"@relativeContributionRate": []
}
},
{
"dimension": "",
"table": {
"@currentValue": [
300
],
"@compareValue": [
210
],
"@growth": [
90
],
"@growthRate": [
0.3
],
"@overallContributionRate": [],
"@relativeContributionRate": []
}
}
]
}