菜单

事件分析请求参数生成指南

事件分析请求参数生成指南

本文档用于指导 AI 或程序自动生成事件分析请求参数。请求应尽量精简、稳定,并使用名称而不是 ID 来描述事件和属性。

核心原则

使用稳定名称生成请求:

  • 事件使用 eventName
  • 事件属性使用 analysis[0]customEvents 中的属性名
  • 筛选和分组属性使用 columnName
  • 公式指标使用 customEvents

不要生成:

  • eventID
  • 属性 id
  • 前端展示和交互字段
  • 空的前端元数据字段

顶层结构

最小结构:

json 复制代码
{
  "eventsSelect": [],
  "eventsFilter": {
    "relation": "and",
    "filterType": "SIMPLE",
    "filters": []
  },
  "eventsGroup": {
    "globalization": []
  },
  "eventsView": {
    "timeParticleSize": "day",
    "recentDay": "0$$6",
    "dynamicDate": ""
  },
  "timeZoneOffset": 0,
  "dataBase": "dt_xxx"
}

dataBase 是必填字段,格式为 dt_xxx

默认事件指标

普通事件总次数:

json 复制代码
{
  "eventType": "default",
  "eventName": "$app_install",
  "eventDisplayName": "App Install Count",
  "analysis": ["A100"],
  "relation": "and",
  "filterType": "SIMPLE",
  "filters": []
}

事件属性聚合:

json 复制代码
{
  "eventType": "default",
  "eventName": "#ad_paid",
  "eventDisplayName": "Ad Revenue",
  "analysis": ["#ad_value", "A103"],
  "relation": "and",
  "filterType": "SIMPLE",
  "filters": []
}

公式指标

使用 customEvents 描述公式指标。

json 复制代码
{
  "eventType": "customized",
  "eventDisplayName": "ROAS",
  "customEvents": "#ad_paid.#ad_value.A103 / DT@first_install.vep$cac.A103",
  "format": "PERCENTAGE",
  "relation": "and",
  "filterType": "SIMPLE",
  "filters": [],
  "customFilters": [
    {
      "relation": "and",
      "filterType": "SIMPLE",
      "filters": []
    },
    {
      "relation": "and",
      "filterType": "SIMPLE",
      "filters": []
    }
  ]
}

规则:

  • customEvents 中每个事件因子都必须有一个对应的 customFilters 项。
  • customFilters 的顺序必须和 customEvents 中事件因子的顺序一致。
  • 公式结果格式使用 format 控制。
  • 如果公式因子参与事件拆分,给公式指标添加 eventSplitIndex

例如:

json 复制代码
{
  "eventSplitIndex": [0, 1]
}

筛选条件

空筛选容器:

json 复制代码
{
  "relation": "and",
  "filterType": "SIMPLE",
  "filters": []
}

普通筛选:

json 复制代码
{
  "relation": "and",
  "filterType": "SIMPLE",
  "filters": [
    {
      "columnName": "$uid",
      "columnDesc": "DT User ID",
      "columnType": "string",
      "tableType": "event",
      "type": 0,
      "comparator": "C06",
      "filterValue": [],
      "extra": {
        "parent_column_type": null
      }
    }
  ]
}

嵌套筛选:

json 复制代码
{
  "relation": "and",
  "filterType": "SIMPLE",
  "filters": [
    {
      "relation": "and",
      "filterType": "SIMPLE",
      "filters": [
        {
          "columnName": "#active_device_brand",
          "columnDesc": "Device Brand",
          "columnType": "string",
          "tableType": "user",
          "type": 1,
          "comparator": "C01",
          "filterValue": ["WIKO", "FCNT"],
          "extra": {
            "parent_column_type": null
          }
        }
      ]
    }
  ]
}

维度属性筛选

维度属性的 type4,需要保留最小 extra

json 复制代码
{
  "columnName": "$active_country_code@full_name@zh-CN",
  "columnDesc": "Country/Region",
  "columnType": "string",
  "tableType": "user",
  "type": 4,
  "comparator": "C00",
  "filterValue": ["美国(US)"],
  "extra": {
    "bound_prop": "$active_country_code",
    "dimension_app_id": "conf",
    "dimension_table_type_code": 1
  }
}

不要为维度属性生成 dimension_idbound_prop_id

对象和对象组属性

对象子属性需要带 extra.parent_column_type

对象子属性:

json 复制代码
{
  "columnName": "item.price",
  "columnDesc": "Item Price",
  "columnType": "number",
  "tableType": "event",
  "type": 2,
  "comparator": "C04",
  "filterValue": ["10"],
  "extra": {
    "parent_column_type": "object"
  }
}

对象组子属性:

json 复制代码
{
  "columnName": "items.price",
  "columnDesc": "Item Price",
  "columnType": "number",
  "tableType": "event",
  "type": 2,
  "comparator": "C04",
  "filterValue": ["10"],
  "extra": {
    "parent_column_type": "objectArray"
  }
}

对象组整体匹配使用 C25C26C27,并且必须带嵌套 filter

  • C25:对象组中存在满足条件的对象
  • C26:对象组中不存在满足条件的对象
  • C27:对象组中所有对象都满足条件
json 复制代码
{
  "columnName": "items",
  "columnDesc": "Items",
  "columnType": "objectArray",
  "tableType": "event",
  "type": 2,
  "comparator": "C25",
  "filterValue": [],
  "extra": {
    "parent_column_type": null
  },
  "filter": {
    "relation": "and",
    "filterType": "SIMPLE",
    "filters": [
      {
        "columnName": "items.price",
        "columnDesc": "Item Price",
        "columnType": "number",
        "tableType": "event",
        "type": 2,
        "comparator": "C04",
        "filterValue": ["10"],
        "extra": {
          "parent_column_type": "objectArray"
        }
      }
    ]
  }
}

维度属性绑定在对象或对象组子属性上时,额外保留父属性信息:

json 复制代码
{
  "columnName": "items.country@full_name@zh-CN",
  "columnDesc": "Item Country",
  "columnType": "string",
  "tableType": "event",
  "type": 4,
  "comparator": "C00",
  "filterValue": ["美国(US)"],
  "extra": {
    "bound_prop": "country",
    "dimension_app_id": "conf",
    "dimension_table_type_code": 0,
    "bound_parent_prop": "items",
    "bound_parent_prop_type": "objectArray"
  }
}

如果对象或对象组子属性用于事件属性聚合,建议同时传 boundProp

json 复制代码
{
  "eventType": "default",
  "eventName": "#purchase",
  "eventDisplayName": "Item Revenue",
  "analysis": ["items.price", "A103"],
  "relation": "and",
  "filterType": "SIMPLE",
  "filters": [],
  "boundProp": [
    {
      "name": "items.price",
      "parent_column_type": "objectArray"
    }
  ]
}

分组

无分组:

json 复制代码
{
  "eventsGroup": {
    "globalization": []
  }
}

普通分组:

json 复制代码
{
  "columnName": "#active_screen_height",
  "columnType": "number",
  "tableType": "user",
  "type": 1,
  "displayName": "Screen Height",
  "propertyRangeType": 2,
  "propertyRange": [800],
  "timeGroupType": "daily",
  "extra": {
    "parent_column_type": null
  }
}

规则:

  • 分组属性需要 displayName
  • 数值分组需要 propertyRangeTypepropertyRange
  • 标签属性按需保留 tagVersiontagHistoryDate

时间范围

动态时间:

json 复制代码
{
  "eventsView": {
    "timeParticleSize": "day",
    "recentDay": "0$$6",
    "dynamicDate": ""
  }
}

静态时间:

json 复制代码
{
  "eventsView": {
    "timeParticleSize": "day",
    "recentDay": "",
    "dateList": ["2026-06-18", "2026-06-24"],
    "dynamicDate": ""
  }
}

时间对比:

json 复制代码
{
  "eventsView": {
    "timeParticleSize": "day",
    "recentDay": "0$$6",
    "dynamicDate": "",
    "comparedDate": [
      {
        "recentDay": "4$$7",
        "dynamicDate": ""
      }
    ]
  }
}

规则:

  • 动态时间优先使用 recentDay
  • 静态时间才使用 dateList
  • 不要生成 comparedDate[].key

事件拆分

json 复制代码
{
  "eventsSpliter": {
    "eventsToSplit": [
      {
        "eventName": "$app_install"
      },
      {
        "eventName": "#session_start"
      }
    ],
    "splitPriority": "first",
    "propertyGroup": [
      {
        "columnName": "#event_name",
        "columnType": "string",
        "tableType": "event",
        "type": 1,
        "displayName": "Event Name",
        "propertyRangeType": 1,
        "propertyRange": [0],
        "timeGroupType": "daily",
        "extra": {
          "parent_column_type": null
        }
      }
    ]
  }
}

规则:

  • eventsToSplit 只需要 eventName
  • 不要生成 eventsToSplit[].eventID
  • 公式指标参与拆分时,在公式指标上添加 eventSplitIndex

不要生成的字段

AI 生成最小请求时,不要包含以下字段:

text 复制代码
key
eventID
id
has_dimension
name
display_name
describe
data_type
table_type_code
table_type
calcu_symbol
defaultOpen
presetEventDisplayName
boundProp when empty
retention_metrics when empty
update_time
debugQuery
eventsGroup.individuality
comparedDate[].key
empty filter.filter
dimension_id
bound_prop_id
eventsToSplit[].eventID

生成前检查

返回请求前检查:

  • 每个事件都有 eventType
  • 默认事件有 eventNameeventDisplayNameanalysisrelationfilterTypefilters
  • 公式事件有 customEventseventDisplayNameformatcustomFilters
  • customFilters 数量和 customEvents 中事件因子数量一致。
  • 筛选属性使用 columnNamecolumnTypetableTypetypecomparatorfilterValueextra
  • 分组属性使用 columnNamecolumnTypetableTypetypedisplayName
  • 不包含 eventID 或属性 id
上一个
事件分析模型API
下一个
Event Analysis Request Generation Guide
最近修改: 2026-06-24