# Product Metric API
As for the call method, please refer to the call method description in Open API
You can read the Product Metrics in the user manual to understand the usage scenario.
# List of Product Metrics
Interface URL
/open/metric-list?token=xxx
Request method
POST
Content-Type
application/json
Request Query parameter
Parameter name | Sample value | Parameter type | Is required | Parameter description |
---|---|---|---|---|
token | xxx | String | Yes | token |
Request Body Parameter
{
"projectId": 102,
"metricName": "retention_1",
"metricDesc": "retention_day1",
"metricModes" ["EVENT","RETENTION"],
"createUser":"root",
"updateUser":"root",
"timeParticleSize":"day"
}
Parameter name | Sample value | Parameter type | Is required | Parameter description |
---|---|---|---|---|
projectId | 102 | Integer | Yes | Project ID |
metricName | retention_1 | String | No | Metric Name |
metricDesc | retention_day1 | String | No | Display name |
metricModes | ["EVENT", "RETENTION"] | List | No | Created from EVENT RETENTION |
createUser | root | String | No | Login user name |
updateUser | root | String | No | Login user name |
timeParticle | day | String | No | Unit of the time period taken for analysis minute:based on one minute minute5: based on five minutes(supported since v3.5) minute10: based on ten minutes (supported since v3.5) hour: based on hours day: based on days week: based on weeks month: based on months total: total |
Successful Response Example
{
"data":
[
{
"metricId": 1,
"projectId": 2,
"metricName": "retention_1",
"metricDesc": "retention_day1",
"metricRemark": "test_retention",
"metricMode": "EVENT",
"createUser": "root",
"updateUser": "root",
"createTime": "2022-12-12 10:10:00",
"updateTime": "2022-12-12 10:10:00",
"timeParticles":[ "minute"],
"format": "FORMAT_FLOAT"
}
],
"return_code": 0,
"return_message": "success"
}
# Product Metrics Query
Interface URL
/open/metric-data?token=xxx
Request method
POST
Content-Type
application/json
Request Query Parameter
Parameter name | Sample value | Parameter type | Is required | Parameter description |
---|---|---|---|---|
token | xxx | String | Yes | token |
Request Body Parameter
{
"eventView": {
"comparedByTime": true,
"comparedStartTime": "2021-12-14 00:00:00",
"comparedEndTime": "2021-12-20 23:59:59",
"comparedRecentDay": "8-14",
"startTime": "2021-12-21 00:00:00",
"endTime": "2021-12-27 23:59:59",
"recentDay": "1-7",
"timeParticleSize": "day",
"groupBy": [{
"columnDesc": "brand",
"columnName": "brand",
"propertyRange": "",
"specifiedClusterDate": "2021-12-28",
"tableType": "event"
}],
"relation": "and",
"filts": [{
"columnDesc": "brand",
"columnName": "brand",
"comparator": "equal",
"filterType": "SIMPLE",
"ftv": ["Apple", "Xiaomi"],
"specifiedClusterDate": "2021-12-28",
"tableType": "event",
"timeUnit": ""
}],
"queryFeature": {
"approximateOn": true,
"globalQueryOn": false
}
},
"metrics":["retention_1","dau"]
"zoneOffset": 0
"projectId": 377,
"useSameResultKey": false,
"useCache": true,
"limit": 1000,
"timeoutSeconds": 10
}
Parameter name | Sample value | Parameter type | Is required | Parameter description |
---|---|---|---|---|
eventView | - | Object | Yes | Metrics common attribute part. |
∟ comparedByTime | true | Boolean | No | Whether to compare the time, TRUE: Yes, FALSE: No |
∟ comparedStartTime | 2021-12-14 00:00:00 | String | No | Contrast time start time (format: yyyy-MM-dd HH: mm: ss), the comparison time is valid when the relative time is empty |
∟ comparedEndTime | 2021-12-20 23:59:59 | String | No | Compare time end time (format: yyyy-MM-dd HH: mm: ss), valid when the comparison time is empty relative to time |
∟ comparedRecentDay | 8-14 | String | No | Comparison time relative time (when comparedByTime is TRUE, this item cannot be empty both with the start time and end time of the comparison time) |
∟ startTime | 2021-12-21 00:00:00 | String | No | Start time (format: yyyy-MM-dd HH: mm: ss), valid when the relative time is empty |
∟ endTime | 2021-12-27 23:59:59 | String | No | End time (format: yyyy-MM-dd HH: mm: ss), valid when the relative time is empty |
∟ recentDay | 1-7 | String | No | Relative time (this item cannot be empty both with the start time and the end time) |
∟ relation | and | String | No | Logical relationship, and: logical and, or: logical or |
∟ timeParticleSize | day | String | Yes | Unit of the time period taken for analysis minute:based on one minute minute5: based on five minutes(supported since v3.5) minute10: based on ten minutes (supported since v3.5) hour: based on hours day: based on days week: based on weeks month: based on months total: total |
∟ groupBy | - | List | No | Grouping property part, zero or more |
∟ columnName | brand | String | Yes | Field name |
∟ columnDesc | Brand | String | No | Field display name |
∟ propertyRange | String | No | Self-defined property interval | |
∟ propertyRangeType | String | No | Property interval type, which can be used as self-defined bucketing conditions when grouping numeric properties def: default interval, divided by the system automatically discrete: each value is an independent group user_defined: defined by the user; the self-defined content is set in propertyRange | |
∟ specifiedClusterDate | 2021-12-28 | String | No | Historical tag version of specified date |
∟ tableType | event | String | Yes | Table type enumeration |
∟ filts | - | List | No | Global filters parts |
∟ columnDesc | Brand | String | No | Field display name |
∟ columnName | brand | String | Yes | Field name |
∟ comparator | equal | String | Yes | Reference: filtering expression of model query API |
∟ filterType | SIMPLE | String | No | Filtering mode, SIMPLE: simple, COMPOUND: compound, default as SIMPLE |
∟ ftv | ["Apple", "Xiaomi"] | List | No | Property comparative with bound literial |
∟ specifiedClusterDate | 2021-12-28 | String | No | Historical tag version of specified date |
∟ tableType | event | String | Yes | Table type enumeration |
∟ timeUnit | String | No | Property filter unit, only valid to relativeEvent*:day,hour,minute | |
∟ queryFeature | - | Object | No | Query configuration |
∟ approximateOn | true | Boolean | No | Enable approximate calculation or not |
metrics | ["retention_1","dau"] | list | Yes | List of Product Metrics |
projectId | 377 | Integer | Yes | Project numeric identity |
zoneOffset | 0 | Integer | No | Time zone |
useCache | true | Boolean | No | Use cache, optional parameter, default value: true |
limit | 1000 | Integer | No | Upper limit of the group number of each analysis object, optional parameter, default value: 1000, maximum value: 10000 |
timeoutSeconds | 10 | Integer | No | Request timeout parameter. Query task should be cancelled after the request times out. |
Successful Response Example
{
"data": {
"result_generate_time": "2021-12-30 11:15:41",
"union_groups": [
[
"Safari",
"apple"
],
[
"Firefox",
"xiaomi"
],
[
"WeChat built-in browser",
"apple"
],
[
"total",
"apple"
],
[
"total",
"xiaomi"
]
],
"x": [
"2021-12-23",
"2021-12-24",
"2021-12-25",
"2021-12-26",
"2021-12-27",
"2021-12-28",
"2021-12-29"
],
"x_compared": [
"2021-12-16",
"2021-12-17",
"2021-12-18",
"2021-12-19",
"2021-12-20",
"2021-12-21",
"2021-12-22"
],
"y": [
{
"retention_1": [
{
"group_cols": [
"Safari",
"apple"
],
"group_num": 3,
"values": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"values_compared": [
"447",
"980",
"1584",
"321",
"285",
"74",
"0"
]
},
{
"group_cols": [
"Firefox",
"xiaomi"
],
"group_num": 3,
"values": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"values_compared": [
"291",
"818",
"1128",
"272",
"219",
"58",
"0"
]
},
{
"group_cols": [
"chrome",
"apple"
],
"group_num": 3,
"values": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"values_compared": [
"231",
"500",
"764",
"214",
"155",
"35",
"0"
]
}
]
},
{
"dau": [
{
"group_cols": [
"total",
"apple"
],
"group_num": 2,
"values": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"values_compared": [
"640",
"811",
"1251",
"1253",
"720",
"113",
"0"
]
},
{
"group_cols": [
"total",
"xiaomi"
],
"group_num": 2,
"values": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"values_compared": [
"277",
"439",
"600",
"666",
"364",
"59",
"0"
]
}
]
}
]
},
"return_code": 0,
"return_message": "success"
}
Response Parameter Description
Parameter name | Sample value | Parameter type | Parameter description |
---|---|---|---|
data | - | Object | Return results |
∟ result_generate_time | 2021/12/29 12:00 | String | Query result generation time |
∟ union_groups | ["Apple"] | List | All Grouping Set |
∟ x | ["2021-12-23"] | List | X-axile time |
∟ x_compared | ["2021-12-16"] | List | X-axile comparison time |
∟ y | - | List | Y-axile data list |
∟ {metricname} | - | List | Y-axile metric information list |
∟ group_cols | ["Apple"] | List | Y-axile metric group |
∟ group_num | 3 | Integer | Y-axile metric group number |
∟ values | ["0"] | List | Y-axile metric value |
∟ values_compared | ["447"] | List | Y-axile time comparison metric value |
return_code | 0 | Integer | Return code |
return_message | success | String | Return message |