多维路径归因
1. 接口描述
多维路径归因(dim_path)用于分析指标变化在 多维组合路径 上的贡献情况。
该能力能够在多个维度(如:渠道 × 品类 × 用户等级)组合下,对:
-
当前 vs 对比
-
总体变化值
-
不同路径组合的贡献
进行拆解,帮助定位影响变化的关键“路径”。
2. 接口 URL
3. 公共请求参数(HEADERS)
| 参数名 | 类型 | 必选 | 最大长度 | 描述 |
|---|---|---|---|---|
| tenant-id | String | 是 | 32 | 租户 ID,用于标识数据空间 |
| auth-type | String | 是 | 32 | 认证方式:UID 或 TOKEN |
| auth-value | String | 是 | 32 | 与 auth-type 对应的认证值 |
公共参数在 Aloudata CAN → 「指标应用」→「API 集成」中可查看。
4. 请求参数(Body)
| 字段名 | 类型 | 必选 | 描述 |
|---|---|---|---|
| metric | String | 是 | 用于归因的指标 |
| metricDefinitions | Map | ✘ | 临时指标定义,如需对指标加过滤条件 |
| dimensions | Array |
是 | 多个参与归因的维度 |
| valueSelectStrategy | Object | 是 | 控制每个维度取 TOP/BOTTOM 几个值 |
| attribution | Object | 是 | 时间对比归因配置 |
| orders | Array | ✘ | 排序配置(通常不必传) |
4.1 metricDefinitions(可选)
用于定义临时指标:
示例:
4.2 valueSelectStrategy(必选)
定义每个维度保留多少个维值参与路径分析。
| 字段名 | 类型 | 描述 |
|---|---|---|
| type | String | 可选值:TOP / BOTTOM |
| number | Integer | 需要选取的数量 |
示例:
表示:每个维度组合选择前10个维值
4.3 attribution(必选)
| 字段名 | 类型 | 是否必选 | 描述 |
|---|---|---|---|
| compareType | String | 是 | 固定为 "TIME_COMPARE" |
| currentTimeConstraint | String | 是 | 当前时间范围 |
| compareTimeConstraint | String | 是 | 对比时间范围 |
| filters | Array | ✘ | 全局过滤条件 |
示例:
"attribution": {
"compareType": "TIME_COMPARE",
"currentTimeConstraint":"[metric_time__month]>=\"2025-01\" AND [metric_time__month]<=\"2025-03\"",
"compareTimeConstraint":"[metric_time__month]>=\"2024-11\" AND [metric_time__month]<=\"2025-01\""
}
5. 请求示例(完整)
{
"metric": "order_amt",
"dimensions": [
"channel",
"product_category",
"user_level"
],
"valueSelectStrategy": {
"type": "TOP",
"number": 10
},
"attribution": {
"compareType": "TIME_COMPARE",
"currentTimeConstraint":"[metric_time__month]>=\"2025-01-04\" AND [metric_time__month]<=\"2025-03-06\"",
"compareTimeConstraint":"[metric_time__month]>=\"2025-01-01\" AND [metric_time__month]<=\"2025-03-01\""
},
"orders": []
}
此示例表示:
-
指标:订单金额(order_amt)
-
维度:渠道 × 品类 × 用户等级 3 维组合
-
每个维度取 TOP 10 的维值
-
时间对比范围为 1-3 月 vs 1-3 月前一周期
-
自动生成所有路径组合
-
返回每条路径的指标变化贡献
6. 响应参数结构
顶层结构
{
"table": {
"channel": [...],
"product_category": [...],
"user_level": [...],
"@currentValue": [...],
"@compareValue": [...],
"@growth": [...],
"@growthRate": [...],
"@overallContributionRate": [...],
"@relativeContributionRate": [...]
}
}
6.1 字段解释
| 字段名 | 描述 |
|---|---|
| channel / product_category / user_level | 每条路径的维度值列表 |
| @currentValue | 当前时间的指标值 |
| @compareValue | 对比时间的指标值 |
| @growth | 增长值(当前 - 对比) |
| @growthRate | 增长率 |
| @overallContributionRate | 整体贡献率(用于排序或图表) |
| @relativeContributionRate | 相对贡献率(可选) |
7. 响应示例(参考结构)
{
"table": {
"channel": ["线上", "线下", "线上"],
"product_category": ["服饰", "家电", "美妆"],
"user_level": ["VIP", "普通", "新客"],
"@currentValue": [300, 120, 150],
"@compareValue": [250, 180, 100],
"@growth": [50, -60, 50],
"@growthRate": [0.2, -0.333, 0.5],
"@overallContributionRate": [0.4, -0.3, 0.2],
"@relativeContributionRate": []
}
}