目录
此内容是否有帮助?

# Event Analysis Model API

Call method See Call method description in Open API doc.

You can read the event analysis in the user manual to understand the usage scenario.

# Event Analysis Query

Interface URL

/open/event-analyze?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",
        "relation": "and",
        "timeParticleSize": "day",
        "eventSplit": {
            "event": {
                "eventDesc": "login",
                "eventName": "login"
            },
            "groupByProp": {
                "columnDesc": "browser",
                "columnName": "browser",
                "propertyRange": "",
                "tableType": "event"
            }
        },
        "groupBy": [{
            "columnDesc": "brand",
            "columnName": "brand",
            "propertyRange": "",
            "specifiedClusterDate": "2021-12-28",
            "tableType": "event"
        }],
        "filts": [{
            "columnDesc": "brand",
            "columnName": "brand",
            "comparator": "equal",
            "filterType": "SIMPLE",
            "ftv": ["apple", "xiaomi"],
            "specifiedClusterDate": "2021-12-28",
            "tableType": "event",
            "timeUnit": ""
        }],
        "queryFeature": {
            "approximateOn": true,
            "globalQueryOn": false
        }
    },
    "events": [{
        "analysis": "TOTAL_TIMES",
        "analysisParams": "",
        "eventName": "login",
        "eventNameDisplay": "total times of loggin",
        "eventSplitIndexes": [0],
        "eventUuid": "7FonAy-G",
        "filts": [],
        "quota": "",
        "relation": "and",
        "type": "normal"
    }, {
        "analysis": "TRIG_USER_NUM",
        "analysisParams": "",
        "eventName": "activity_attend",
        "eventNameDisplay": "Number of Trigger Users Attending Activities",
        "eventUuid": "K9A5NDAz",
        "filts": [{
            "columnDesc": "app version",
            "columnName": "app_version",
            "comparator": "notNull",
            "filterType": "SIMPLE",
            "ftv": [],
            "specifiedClusterDate": "2021-12-28",
            "tableType": "event",
            "timeUnit": ""
        }],
        "quota": "",
        "quotaEntities": [{
            "index": 0,
            "taIdMeasure": {
                "columnDesc": "only user ID",
                "columnName": "#user_id",
                "tableType": "event"
            }
        }],
        "relation": "and",
        "type": "normal"
    }, {
        "customEvent": "logout.PER_CAPITA_TIMES",
        "customFilters": [],
        "eventName": "custom indicator",
        "eventNameDisplay": "",
        "eventSplitIndexes": [],
        "eventUuid": "gxqT19xz",
        "filts": [],
        "format": "float",
        "quota": "",
        "quotaEntities": [{
            "index": 0,
            "taIdMeasure": {
                "columnDesc": "email",
                "columnName": "email",
                "tableType": "user"
            }
        }],
        "quotaTimeRanges": [{
            "index": 0,
            "params": ["1"],
            "type": "THIS_WEEK"
        }],
        "relation": "and",
        "type": "customized"
    }],
    "projectId": 377,
    "useSameResultKey": false,
    "useCache": true,
    "limit": 1000,
    "timeoutSeconds": 10
}

::: TIP

Imported parameters are composed of many parts: basic parameters must be selected; Time comparison parameters, event splitting parameters, group item parameters, global filter item parameters, query configuration item parameters are optional; Choose one of common analysis indicators and custom analysis indicators.

:::

# Request Parameter Description

Parameter name
Sample value
Parameter type
Is required
Parameter description
eventView
-
Object
Yes
Grouping properties
comparedByTime true
Boolean
No
Whether to compare 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 event (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 at the same time as 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 at the same time as 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 time for analysis
Press 1 minute
Minute 5: Press 5 minutes (v3.5 starts to support)
Minute 10: Press 10 minutes (v3.5 start support)
By the hour
By day
Week: by week
Month: by month
Total: total
eventSplit -
Object
No
Event Split Information
event -
Object
Yes
Event splitting event information
eventDesc Login
String
No
Event split indicator display name
eventName login
String
Yes
Event splitting indicator event name
groupByProp -
Object
Yes
Event splitting indicator grouping information
columnDesc Browser
String
No
Event split grouping field display name
columnName browser
String
Yes
Event split grouping field field name
propertyRange String
No
Event splitting grouping attribute interval
tableType event
String
Yes
Event split table type, event: transaction table, user: user table
groupBy -
List
No
Group attributes, can have zero or more
columnName brand
String
Yes
Field name
columnDesc Brand
String
No
Field display name
propertyRange String
No
Custom attribute interval
propertyRangeType String
No
Property interval type, when grouping numeric properties, you can customize bucketing conditions
Def: default interval, automatically divided by the system
Discrete: Each value is an independent group
user_defined: User defined. Custom content is set in propertyRange
specifiedClusterDate 2021-12-28
String
No
Cluster specified date
tableType event
String
Yes
Table type, event: transaction table, user: user table
filts -
List
No
Global filter
columnDesc Brand
String
No
Field display name
columnName brand
String
Yes
Field name
comparator equal
String
Yes
Reference: Filtered expression for model query API
filterType SIMPLE
String
No
Filter mode, SIMPLE: simple, COMPOUND: composite
ftv ["Apple", "Xiaomi"]
List
No
Property comparison value
specifiedClusterDate 2021-12-28
String
No
Cluster specified date
tableType event
String
Yes
Table type, event: transaction table, user: user table
timeUnit String
No
Property comparison units, valid for relativeEvent * only: day, hour, minute
queryFeature -
Object
No
Query configuration
approximateOn true
Boolean
No
Whether to turn on approximate calculation
globalQueryOn false
Boolean
No
Whether to turn on multi-cluster computing
events
-
List
Yes
List of event indicators
analysis TRIG_USER_NUM
String
No
Analysis angle, aggregation operation, see the following table for details
analysisParams String
No
Analysis angle parameter (analysis cannot be empty when it is PERCENTILE, the value range: 1-100, representing several points)
eventName activity_attend
String
Yes
Event type, in particular, you can use anyEvent to represent any event
eventNameDisplay Number of trigger users participating in the event
String
No
Event display name
eventUuid K9A5NDAz
String
No
Event UUID, used to identify event unique
filts -
List
No
List of conditions
columnDesc App version
String
No
Field display name
columnName app_version
String
Yes
Field name
comparator notNull
String
Yes
Reference: Filtered expression for model query API
filterType SIMPLE
String
No
Filter mode, SIMPLE: simple, COMPOUND: composite
ftv []
List
No
Property comparison value
specifiedClusterDate 2021-12-28
String
No
tableType event
String
Yes
Table type, event: transaction table, user: user table
timeUnit String
No
Filter time unit
quota String
No
Indicator attributes (with analysis, meaning which attribute of which analysis angle)
quotaDesc String
No
Indicator property display name
quotaEntities -
List
List of subjects corresponding to the analysis event indicator
index 0
Integer
Yes
Analyze the subject subscript corresponding to the event indicator
taIdMeasure -
Object
Query ID system configuration
columnDesc User unique ID
String
No
Field display name
columnName #user_id
String
Yes
Field name
tableType event
String
Yes
Table type, event: transaction table, user: user table
relation and
String
No
Logical relationship, and: logical and, or: logical or
type normal
String
Yes
Normal: general analysis
Customized: Custom formula
customEvent logout.PER_CAPITA_TIMES
String
No
Formula expression consisting of addition, subtraction, multiplication and division of analytical terms or numerical constants. Analysis terms come in two forms: eventN ame.column N ame.analysis or eventN ame.analysis.
customFilters []
List
No
Formula expression filter item list
eventName Custom indicators
String
Yes
Custom indicator display name
eventNameDisplay String
No
eventSplitIndexes []
List
No
Items involved in event splitting
eventUuid gxqT19xz
String
No
Custom indicator UUID to identify indicators as unique
filts []
List
No
Filter List
format float
String
No
Options to display data
Float: two decimal places, float3: three decimal places, float4: four decimal places, percent: percentage
quota String
No
Indicator attributes (with analysis, meaning which attribute of which analysis angle)
quotaDesc String
No
Indicator property display name
quotaEntities -
List
No
List of subjects corresponding to the analysis event indicator
index 0
Integer
Yes
Analyze the subject subscript corresponding to the event indicator
taIdMeasure -
Object
Yes
Query ID system configuration
columnDesc Mailbox
String
No
Field display name
columnName email
String
Yes
Field name
tableType user
String
Yes
Table type, event: transaction table, user: user table
quotaTimeRanges []
List
No
List of indicator time period information
index 0
Integer
Yes
Time period subscript
params ["1"]
List
No
Time period parameter
type THIS_WEEK
String
Yes
Time period type
LAST_DAYS: past few days, RECENT_DAYS: recent days, THIS_WEEK: current week, THIS_MONTH: current month
relation and
String
No
Logical relationship, and: logical and, or: logical or
type customized
String
Yes
Normal: General analysis
Customized: Custom formula
projectId
377
Integer
Yes
Project Id
useSameResultKey
false
Boolean
No
Whether to use the same event name when the event names are the same
True: use the same event name
False: The event names are the same, add a prefix number
useCache
true
Boolean
No
Use cache, optional parameter, default is true
limit
1000
Integer
No
Maximum number of groups per analysis object, optional parameters, default is 1000, maximum is 10000
timeoutSeconds
10
Integer
No
Request timed out parameter, timeout cancels query task

Aggregation method analysis value:

Value
Description
Whether properties are required
TOTAL_TIMES
Total number
No
TRIG_USER_NUM
Number of users triggered
No
PER_CAPITA_TIMES
Number of times per capita
No
SUM
Sum of values
Yes
AVG
Numerical average
Yes
FOR _ CAPITA _ NUM
Per capita
Yes
MAX
Maximum value
Yes
MIN
Numerical minimum
Yes
DISTINCT
Deduplicate number
Yes
TRUE
True number
Yes
FALSE
False number
Yes
IS_NOT_EMPTY
Not an empty number
Yes
IS_EMPTY
Null number
Yes
ARRAY_DISTINCT
List overall deduplicate number
Yes
ARRAY_SET_DISTINCT
Element collection deduplicate number
Yes
ARRAY_ITEM_DISTINCT
List element deduplicate number
Yes
MEDIAN
Median
Yes
PERCENTILE
Percepentiles
Yes

# Successful Response Example

Under the same conditions, the results of the trend chart and date table after the TA event analysis operation are as follows

{
    "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": [
            {
                "login.TOTAL_TIMES": [
                    {
                        "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": [
                            "WeChat built-in browser",
                            "apple"
                            ],
                        "group_num": 3,
                        "values": [
                            "0",
                            "0",
                            "0",
                            "0",
                            "0",
                            "0",
                            "0"
                        ],
                        "values_compared": [
                            "231",
                            "500",
                            "764",
                            "214",
                            "155",
                            "35",
                            "0"
                        ]
                    }
                ]
            },
            {
                "activity_attend.TRIG_USER_NUM": [
                    {
                        "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"
                        ]
                    }
                ]
            },
            {
                "Custom Indicators": [
                    {
                        "group_cols": [
                            "total",
                            "apple"
                        ],
                        "group_num": 2,
                        "values": [
                            "1",
                            "1",
                            "1",
                            "1",
                            "0",
                            "0",
                            "0"
                        ],
                        "values_compared": [
                            "1.01",
                            "1.01",
                            "1.01",
                            "1.01",
                            "1",
                            "1",
                            "1"
                        ]
                    },
                    {
                        "group_cols": [
                            "total",
                            "xiaomi"
                        ],
                        "group_num": 2,
                        "values": [
                            "1",
                            "1",
                            "1",
                            "1",
                            "0",
                            "0",
                            "0"
                        ],
                        "values_compared": [
                            "1.01",
                            "1.01",
                            "1.01",
                            "1.01",
                            "1",
                            "1",
                            "1"
                        ]
                    }
                ]
            }
        ]
    },
    "return_code": 0,
    "return_message": "success"
}

# Response Parameter Description

Parameter name
Sample value
Parameter type
Parameter description
data
-
Object
Return result
result_generate_time 2021-12-29 12:00:00
String
Query result generation time
union_groups ["Apple"]
List
Group
x ["2021-12-23"]
List
X-axis time
x_compared ["2021-12-16"]
List
X-axis comparison time
y -
List
Y-axis data list
{Indicatorname} -
List
Y-axis indicator information list
group_cols ["Apple"]
List
Y-axis indicator grouping
group_num 3
Integer
Y-axis indicator grouping number
values ["0"]
List
Y-axis indicator value
values_compared ["447"]
List
Y-axis time comparison index value
return_code
0
Integer
Return code
return_message
success
String
Return information

Error Response Example

{
    "return_code": -1008,
    "return_message": "参数(token)为空"
}
Parameter name
Sample value
Parameter type
Parameter description
return_code
-1008
Integer
Return code
return_message
The parameter (token) is empty
String
Return information

Curl **E**xample

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"projectId": 377,"useSameResultKey": false,"useCache": true,"limit": 1000,"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","relation": "and","timeParticleSize": "day","eventSplit": {"event": {"eventDesc": "登录","eventName": "login"},"groupByProp": {"columnDesc": "浏览器","columnName": "browser","propertyRange": "","tableType": "event"}},"groupBy": [{"columnDesc": "品牌","columnName": "brand","propertyRange": "","specifiedClusterDate": "2021-12-28","tableType": "event"}],"filts": [{"columnDesc": "品牌","columnName": "brand","comparator": "equal","filterType": "SIMPLE","ftv": ["苹果", "小米"],"specifiedClusterDate": "2021-12-28","tableType": "event","timeUnit": ""}],"queryFeature": {"approximateOn": true,"globalQueryOn": false}},"events": [{"analysis": "TOTAL_TIMES","analysisParams": "","eventName": "login","eventNameDisplay": "登录的总次数","eventSplitIndexes": [0],"eventUuid": "7FonAy-G","filts": [],"quota": "","relation": "and","type": "normal"}, {"analysis": "TRIG_USER_NUM","analysisParams": "","eventName": "activity_attend","eventNameDisplay": "参加活动的触发用户数","eventUuid": "K9A5NDAz","filts": [{"columnDesc": "app版本","columnName": "app_version","comparator": "notNull","filterType": "SIMPLE","ftv": [],"specifiedClusterDate": "2021-12-28","tableType": "event","timeUnit": ""}],"quota": "","quotaEntities": [{"index": 0,"taIdMeasure": {"columnDesc": "用户唯一ID","columnName": "#user_id","tableType": "event"}}],"relation": "and","type": "normal"}, {"customEvent": "logout.PER_CAPITA_TIMES","customFilters": [],"eventName": "自定义指标","eventNameDisplay": "","eventSplitIndexes": [],"eventUuid": "gxqT19xz","filts": [],"format": "float","quota": "","quotaEntities": [{"index": 0,"taIdMeasure": {"columnDesc": "邮箱","columnName": "email","tableType": "user"}}],"quotaTimeRanges": [{"index": 0,"params": ["1"],"type": "THIS_WEEK"}],"relation": "and","type": "customized"}]}' 'http://ta2:8992/open/event-analyze?token=bTOzKiTIozG4e19FgXphcA8dDV3DIY8RwdHTO7aSnBsRqSNaIk19BnBMecJDWibD'

# Event Analysis User List

Interface URL

/open/event-user-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": 0,
  "eventView": {
    "startTime": "2019-11-24 00:00:00",
    "endTime": "2019-11-26 00:00:00",
    "recentDay": "1-3",
    "timeParticleSize": "day",
    "groupBy": [
      {
        "columnName": "#city",
        "tableType": "event"
      }
    ]
  },
  "events": [
    {
      "analysis": "TRIG_USER_NUM",
      "eventName": "consume_item",
      "quota": "#vp@dailyTask",
      "relation": "and",
      "type": "normal",
      "filts": [
      {
          "columnName": "user_level",
          "comparator": "equal",
          "ftv": [
            "5"
          ],
          "tableType": "user"
        }
      ],
    }
  ],
  "sliceDate": "2019-11-26",
  "sliceGroupVal": [
    "Beijing"
  ],
  "timeoutSeconds": 10
}

# Request Parameter Description

Parameter name
Sample value
Parameter type
Is required
Parameter description
projectId
0
String
Yes
Parameter description
eventView
-
Object
Yes
Group property table
startTime 2019-11-24 00:00:00
String
No
Start time (format: yyyy-MM-dd HH: mm: ss), valid when the relative time is empty
endTime 2019-11-26 00:00:00
String
No
End time (format: yyyy-MM-dd HH: mm: ss), valid when the relative time is empty
recentDay 1-3
String
No
Relative time (this item cannot be empty at the same time as the start time and the end time)
timeParticleSize day
String
Yes
Unit of time for analysis
Press 1 minute
Minute 5: Press 5 minutes (v3.5 starts to support)
Minute 10: Press 10 minutes (v3.5 start support)
By the hour
By day
Week: by week
Month: by month
Total: total
groupBy -
List
No
Group attributes, can have zero or more
columnName #city
String
Yes
Field name
tableType event
String
Yes
Table type, event: transaction table, user: user table
events
List
Yes
List of event indicators
analysis TRIG_USER_NUM
String
No
Analysis types, aggregation operations, see the table below
eventName consume_item
String
Yes
Event type, in particular, you can use anyEvent to represent any event
quota # vp@dailyTask
String
No
Indicator attributes (with analysis, meaning which attribute of which analysis angle)
relation and
String
No
Logical relationship, and: logical and, or: logical or
type normal
String
Yes
Normal: General analysis
Customized: Custom formula
filts -
List
No
Filter List
columnName user_level
String
Yes
Field name
comparator equal
String
Yes
Reference: Filtered expression for model query API
ftv ["5"]
List
No
Property comparison value
tableType user
String
Yes
Table type, event: transaction table, user: user table
sliceDate
"2019-11-26"
String
No
Event date
sliceGroupVal
["Beijing"]
List
Yes
Event location grouping
timeoutSeconds
10
Integer
No
Request timed out parameter, timeout cancels query task

# Successful Response Example

{
  "data": {
    "datalist": [
      {
        "#account_id": "e78107482",
        "#distinct_id": "e145056682",
        "user_level": 5,
        "register_time": "2019-11-26 14:36:13",
        "diamond_num": 1006,
        "latest_login_time": "2019-11-26 15:45:16",
        "channel": "app store",
        "#user_id": 33474682
      },
      {
        "#account_id": "d7819213",
        "#distinct_id": "d14521393",
        "user_level": 5,
        "register_time": "2019-11-26 23:25:14",
        "diamond_num": 858,
        "first_recharge_time": "2019-11-26 23:29:56",
        "latest_login_time": "2019-11-26 23:32:48",
        "channel": "app store",
        "#user_id": 3351093
      }
    ],
    "columMeta": {
      "#account_id": "account ID",
      "#distinct_id": "visitor ID",
      "user_level": "user level",
      "register_time": "register time",
      "diamond_num": "diamond number",
      "first_recharge_time": "first recharge time",
      "latest_login_time": "lastest login time",
      "channel": "channel"
    }
  },
  "return_code": 0,
  "return_message": "success"
}

# Response parameter description

Parameter name
Sample value
Parameter type
Parameter description
return_code
0
Integer
Return code
return_message
success
String
Return information
data
-
Object
Return result
datalist -
List
User Information
columMeta -
Map
Field meaning mapping

Error Response Example

{
    "return_code": -1008,
    "return_message": "The parameter (token) is empty"
}
Parameter name
Sample value
Parameter type
Parameter description
return_code
-1008
Integer
Return code
return_message
The parameter (token) is empty
String
Return information