跳转至

多维归因(时间对比)

1. 接口描述

用于对某指标按维度进行时间对比归因。
根据“当前时间”与“对比时间”的差异,计算:增长、增长率、贡献率等。

2. 接口 URL

POST /anymetrics/api/v1/attribution/dim_time_compare

3. 公共请求参数(HEADERS)

参数 类型 必选 描述
tenant-id String 租户空间标识
auth-type String 认证方式:UID / TOKEN
auth-value String 认证值

公共参数获取方式

在 Aloudata CAN 顶部导航选择「指标应用」,左侧菜单进入「API 集成」页面,获取 tenant-id 和 auth-value。

image.png


4. 请求参数

字段 类型 必选 描述
metric String 指标名称
metricDefinitions Map 临时指标定义
dimensions List 参与归因的维度
attribution Object 归因参数

attribution 字段

字段 类型 描述
attributionCalculateType String AVG / ALL
currentTimeConstraint String 当前时间范围
compareTimeConstraint String 对比时间范围
filters List 全局过滤条件

请求示例

{
  "metric": "order_count_temp1",
  "metricDefinitions":{
    "order_count_temp1": {
      "refMetric": "order_count",
      "filters": ["IN([province],\"浙江\",\"江苏\")"]
    }
  },
  "dimensions": ["channel"],
  "attribution":{
    "attributionCalculateType": "AVG",
    "currentTimeConstraint": "[metric_time__day]=\"2025-07-07\"",
    "compareTimeConstraint": "[metric_time__day]=\"2025-07-06\"",
    "filters": []
  }
}

5. 响应参数说明

字段 描述
tables 归因结果列表,每个维度组合为一项
dimensions 维度值组合
table 每个维度组合下的归因指标

table 字段

字段 含义
@currentValue 当前值
@compareValue 对比值
@growth 增长值
@growthRate 增长率
@overallContributionRate 整体贡献率
@relativeContributionRate 相对贡献率

6. 使用说明

  • 用于“同一维度下,不同时点”的指标变化贡献分析。

  • AVG 表示归因按均值计算,ALL 按整体值计算。