Multidimensional Attribution by Time Comparison
1. API Description
Used to perform time-comparison attribution for a metric by dimension.
It calculates growth, growth rate, contribution rate, and related indicators based on the difference between the current time range and the comparison time range.
2. API URL
3. Common Request Headers
| parameter | Type | required | Description |
|---|---|---|---|
| tenant-id | String | Yes | Tenant space identifier |
| auth-type | String | Yes | Authentication method. Supports UID, TOKEN, ACCOUNT, and APIKEY. |
| auth-value | String | Yes | Authentication value corresponding to auth-type. |
How to Obtain Common parameters
In Aloudata CAN, select Metric Applications in the top navigation bar, then select API Integration in the left navigation menu. You can obtain tenant-id on the API Integration page. Set auth-value according to auth-type.

4. Request parameters
| Field | Type | required | Description |
|---|---|---|---|
| metric | String | ✔ | Metric name |
| metricDefinitions | Map | ✘ | Temporary metric definitions |
| dimensions | List | ✔ | Dimensions participating in attribution |
| attribution | Object | ✔ | Attribution parameters |
attribution Field
| Field | Type | Description |
|---|---|---|
| attributionCalculateType | String | AVG / ALL |
| currentTimeConstraint | String | Current time range |
| compareTimeConstraint | String | Comparison time range |
| filters | List | Global filters |
Request Example
{
"metric": "order_count_temp1",
"metricDefinitions":{
"order_count_temp1": {
"refMetric": "order_count",
"filters": ["IN([province],\"Zhejiang\",\"Jiangsu\")"]
}
},
"dimensions": ["channel"],
"attribution":{
"attributionCalculateType": "AVG",
"currentTimeConstraint": "datetrunc[metric_time],\"day\")=\"2025-07-07\"",
"compareTimeConstraint": "datetrunc[metric_time],\"day\")=\"2025-07-06\"",
"filters": []
}
}
5. Response parameter Description
| Field | Description |
|---|---|
| tables | Attribution result list. Each dimension combination is one item |
| dimensions | Dimension value combination |
| table | Attribution metrics for each dimension combination |
table Field
| Field | Description |
|---|---|
| @currentValue | Current value |
| @compareValue | Comparison value |
| @growth | Growth value |
| @growthRate | Growth rate |
| @overallContributionRate | Overall contribution rate |
| @relativeContributionRate | Relative contribution rate |
6. Usage Notes
-
Use this API to analyze contribution to metric changes for the same dimension across different time points.
-
AVGcalculates attribution by average value, andALLcalculates attribution by overall value.
7. Call Example
Query Request
curl --location --request POST 'http://127.0.0.1:8083/anymetrics/api/v1/attribution/dim_time_compare' \
--header 'auth-type: UID' \
--header 'tenant-id: tn_19487697' \
--header 'auth-value: 463663891121963008' \
--header 'Accept-Language: zh-CN' \
--header 'Content-Type: application/json' \
--data-raw '{
"compareType": "SAME_PERIOD",
"metric": "countDistinct_product_id",
"dimensions": [
"brand",
"price_band"
],
"attribution": {
"attributionCalculateType": "ALL",
"currentTimeConstraint": "DateTrunc([metric_time],\"DAY\") = DateTrunc(Cast(\"2025-07-11 00:00:00\",\"Timestamp\"),\"DAY\")",
"compareTimeConstraint": "DateTrunc([metric_time],\"DAY\") = DateAdd(DateTrunc(Cast(\"2025-07-11 00:00:00\",\"Timestamp\"),\"DAY\"),-1,\"DAY\")"
}
}'
Response Example
{
"data": {
"tables": [
{
"dimension": "brand",
"table": {
"@currentValue": [
6,
8,
13,
8,
7,
7,
11
],
"@compareValue": [
6,
8,
13,
8,
7,
7,
11
],
"@overallContributionRate": [
null,
null,
null,
null,
null,
null,
null
],
"@growthRate": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"@growth": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"brand": [
"Lepin",
"Kangyi",
"Baiwei",
"Youxuan",
"Dianfan",
"Qingquan",
"Fresh Choice"
]
},
"warning": null,
"empty": false
},
{
"dimension": "price_band",
"table": {
"@currentValue": [
23,
6,
31
],
"@compareValue": [
23,
6,
31
],
"@overallContributionRate": [
null,
null,
null
],
"price_band": [
"40-60",
"0-20",
"20-40"
],
"@growthRate": [
"0",
"0",
"0"
],
"@growth": [
"0",
"0",
"0"
]
},
"warning": null,
"empty": false
},
{
"dimension": null,
"table": {
"@currentValue": [
60
],
"@compareValue": [
60
],
"@growthRate": [
"0"
],
"@growth": [
"0"
]
},
"warning": null,
"empty": false
}
],
"warning": null
},
"success": true,
"code": "200",
"errorMsg": null,
"detailErrorMsg": null,
"traceId": "2537fe72c3f84f51892047a537d3592a.185.17780503785580007"
}