You need to enable JavaScript to run this app.
导航
指标分析树 WebHook
最近更新时间:2024.09.11 17:39:27首次发布时间:2024.02.22 14:46:17

1. 概述

指标分析树 WebHook 是归因决策中的一个重要功能,通过向已注册的WebHook推送指标分析树相关的数据,帮助用户及时获取业务归因和决策支持。指标分析树的报告数据规模较大,本产品采用两阶段方式进行整棵树的报告数据同步,提高了数据同步的效率和稳定性。指标分析树WebHook适用于各种业务场景,具有灵活性和可扩展性,为用户提供了及时、准确的业务数据支持。(归因决策为增值模块,需单独付费方可使用,自V2.62.0及以上版本支持。如您需要使用,请联系贵公司的商务人员或客户成功经理咨询购买事宜)。
阶段一:指标分析树计算完毕之后,若用户配置了 WebHook 订阅,则系统会将指标分析树元信息通过 WebHook 推送给用户。
阶段二:用户根据 WebHook 推送的元信息,可以自行组拼成树结构,然后可以分别调用本产品的 OpenAPI 请求节点详情数据。

2. WebHook

2.1 注册WebHook

第一步:在"项目中心"界面,点击左下角的"WebHook配置",点击右上角的"新建配置"。
图片
第二步:请您完成以下内容的配置。

  • 名称:填写一个可读的名字即可
  • URL:用于接收WebHook数据推送的服务地址
  • Secret:填写所需机制即可
  • 订阅事件:勾选"归因报告"即可

图片

2.2 WebHook返回的约定格式

当前仅支持通过POST请求推送数据,当接收方正常收到数据时,结果要包含:

{"code": 0, "data": ""}

这是为了方便出错后重试推送WebHook,如果出错的话code返回-1即可。当前重试的逻辑是每10秒尝试一次,最多尝试5次。

2.3 订阅WebHook

第一步:进入指标树的配置页面,点击"更多" -> "新建订阅"。
图片
第二步:推送方式选择"WebHook",在下拉列表中选择对应的WebHook,然后点击"确定"即可。
图片

3. 指标分析树元信息

推送方式:WebHook
推送格式:元信息

3.1 元信息概览

{
    "taskId": "xxx", // 为分析树的唯一标志性[不变],和风神归因报告的sceneId为同一值
    "reportId": 19000,
    "submitJobId": 1001, // 自定义计算的树WebHook返回的数据中为>0的数字,其他情况下为-1
    "name": "xxx",
    "user": "xxx@bytedance.com",
    "appId": 111,
    "baseDateStr": "2023-02-20",
    "cmpDateStr": "2023-02-23",
    "generateType": "regular", // regular例行计算, custom 自定义计算
    "granularity": "day", // day 日, week 周, biweek 双周,month 月,bimonth 双月
    "components": [{}], // 存储所有节点,第一个为开始节点
}

3.2 指定指标节点

{    
    "type": "metric",
    "id": "b3a33a634568485abac9d9cc403fe93f", // 长度为32位的字符串
    "name": "xxx",
    "parentId": [""],
    "nextId": [""],
    "column": "xxx",  // 指标名称
    "aggregate": "AGG",  // 聚合方式
    "status": "finish", // unready | running | finish | failed
    "msg": "",  // 异常信息
    "nlg": "", // 结果简述
    "params": {  //请求的detail参数
        
    }
}

3.3 筛选节点

{   
    "type": "limit",
    "id": "xxx",
    "name": "xxx",
    "parentId": [""],
    "nextId": [""],
    "status": "", // unready | running | finish | failed
    "msg": "",  // 异常信息
}

3.4 指标节点

(1)指标贡献率节点

{   
    "type": "metricContribution", 
    "id": "xxx",
    "name": "xxx",
    "parentId": [""],
    "nextId": [""],
    "column": "",  // 指标名称
    "aggregate": "",  // 聚合方式
    "nlg": "",
    "status": "", // unready | running | finish | failed | wontDrill
    "msg": "",  // 异常信息
    "params": {  //请求的detail参数
        
    }
 
}

(2)指标拆解组节点

{   
    "type": "metricContributionGroup",  
    "id": "",
    "name": "",
    "parentId": [""],
    "nextId": [""],
    "nlg": "",
    "status": "", // unready | running | finish | failed
    "msg": "",  // 异常信息
    "params": {  //请求的detail参数
        
    }
}

3.5 维度节点

(1) 维度贡献率节点

{   
    "type": "dimensionContribution",  
    "id": "xxx",
    "name": "xxx",
    "parentId": [""],
    "nextId": [""],
    "nlg": "",
    "status": "", // unready | running | finish | failed
    "msg": "",  // 异常信息
    "params": {  //请求的detail参数
    }
}

(2) 维度拆解节点

{   
    "type": "dimensionContributionGroup",   
    "id": "",
    "name": "",
    "parentId": [""],
    "nextId": [""],
    "nlg": "",
    "status": "", // unready | running | finish | failed
    "msg": "",  // 异常信息
    "params": {  //请求的detail参数, 多条路径,多次渲染
       "query": [ // 里面的item每次请求,主要是为了解决单条路径数据大的问题,必须分批次请求
           {
              "group": {
                "column": "",
                "value": ""
              },
              "metaId": "4KHOE53V53_5715_dataset",
              "algorithm": "adtributor",
              "sceneId": "555371_scene_rlmon_1665323238",
              "reportId": 15933,
              "drilldown":
                [
                  {
                    "column": "user_unique_id",
                    "displayColumn": "user_unique_id",
                    "values": []
                  }
                ],
              "sections": [
                "trend",
                "table"
              ]
           },
           {
              "group": {
                "column": "",
                "value": ""
              },
              "metaId": "4KHOE53V53_5715_dataset",
              "algorithm": "adtributor",
              "sceneId": "555371_scene_rlmon_1665323238",
              "reportId": 15933,
              "drilldown":   
                [
                  {
                    "column": "hour",
                    "displayColumn": "hour",
                    "values": []
                  }
                ]
              ,
              "sections": [
                "trend",
                "table"
              ]
           }
       ]

    }
}

3.6 异动节点

{
    "name": "xxx",
    "parentId": [""],
    "nextId": [],
    "type": "anomaly",
    "id": "xxx",
    "status": "finish", // unready | running | finish | failed
    "msg": "",
    "nlg": "",
    "isAnomaly": true, // 结果是否有异动
    "params": { // **detail请求参数
        
    }
}

3.7 趋势异动节点

{
                    
    "name": "xxx",
    "parentId": [""],
    "nextId": [ ],
    "type": "trendAnomaly",
    "id": "xxx", 
    "status": "finish", // unready | running | finish | failed
    "msg": "",
    "nlg": " 双月累计GMV fluctuated abnormally, period over period ratio -0.3159521303568871 lower than the lower limit of -0.1,wow ratio -0.3159521303568871 lower than the lower limit of -0.1,\n",
    "isAnomaly": true, // 结果是否有异动
    "params": { // **detail请求参数
    
    }
}

3.8 文本节点

{
                    
    "name": "xxx",
    "parentId": [""],
    "nextId": [ ],
    "type": "trendAnomaly",
    "id": "xxx", 
    "status": "finish", // unready | running | finish | failed
    "msg": ""
    
}

4. 获取指标分析树节点明细数据

请求方式:OpenAPI
Request:

{
    "user": "",
    "appId": "appId的值", // 元信息概览返回的json中的appId的值
    "topn": 20, // 归因节点、指标节点需要加上该参数,最多100, 异动节点不需要
    **params  // 节点里的params字段,进行打平,维度拆解节点需要特殊分开请求
}

4.1 异动节点返回数据

{"timeline": {[
  {
    "forecast": [  //预测值
      0.10225288821444913,
      0.10723902747508679,
      0.10146196102774055,
      0.0935449505956909,
      0.09329767175995837
    ],
    
    "lower": [  //下界
      0.0993665228302924,
      0.09435444914272857,
      0.09565728623696215,
      0.10225288821444913,
      0.10723902747508679,
      0.10146196102774055,
      0.0935449505956909,
      0.09329767175995837
    ],
    "measure": "视频审出率(不含众包转送)",  //指标名称
    "self": [  // 真实值
      
      0.0993665228302924,
      0.09435444914272857,
      0.09565728623696215,
      0.10225288821444913,
      0.10723902747508679,
      0.10146196102774055,
      0.0935449505956909,
      0.09329767175995837
    ],
    "status": {
      "anomalyDirection": "normal",  //异动
      "baseDate": "2023-02-21",        // 基准日,异动规则下有效
      "baseValue": 0.0935449505956909,  //基准值,异动规则下有效
      "compareDate": "2023-02-22",  //对比日
      "compareValue": 0.09329767175995837,  //对比值 
      "diff": -0.0002472788357325284,
      "isAnomaly": false,  // 是否异动
      "summary": "没有显著变化",  // 总结
    },
    "time": [  //时间
      
      "2023-02-10",
      "2023-02-11",
      "2023-02-12",
      "2023-02-13",
      "2023-02-14",
      "2023-02-15",
      "2023-02-16",
      "2023-02-17",
      "2023-02-18",
      "2023-02-19",
      "2023-02-20",
      "2023-02-21",
      "2023-02-22"
    ],
    "upper": [  // 上界

      0.10794305013779512,
      0.104984576091283,
      0.10340387805625556,
      0.0993665228302924,
      0.09435444914272857,
      0.09565728623696215,
      0.10225288821444913,
      0.10723902747508679,
      0.10146196102774055,
      0.0935449505956909,
      0.09329767175995837
    ]
  }
]}}

4.2 归因节点返回数据

"table": {[
  {
    "baseVal": 0.25403483541067434,  // 基期值 
    "cmpVal": 0.18116681549517372,  // 对比值
    "contribution": -0.0038332325412458873,  // 贡献率
    "diff": -0.07286801991550063,  // 差值
    "displayDrillPath": [  // 下钻维度
      "pipeline_infos_reason"
    ],
    "drillPath": [
      "pipeline_infos_reason"
    ], 
    "factor": "positive",  // 贡献方向,positive: 正向 negative: 反向
 
    "pathValue": [  //下钻维度值
      "current_politics_review"
    ],
    "pop": -0.28684262848322245, // 环比
    "score": 0.5998189061843369, // 贡献值
  }
]}

4.3 趋势异动抽屉结果

{
    "timeline": [
        {
            "self": [1, 2],
            "time": ["01/02", "02/04"],
            "measure": "gmv",
            "status": {
                  "baseDate": "2022-11-07",
                  "baseValue": 3821565.8428020044,
                  "compareDate": "2022-11-14",
                  "compareValue": 3720264.032154001,
                  "diff": -101301.8106480036,
                  "isAnomaly": false,
                  "pop": -0.026507932825181484
                }
        },
                {
            "self": [1, 2],
            "time": ["01/02", "02/04"],
            "measure": "countXXX",
            "status": {
                  "baseDate": "2022-11-07",
                  "baseValue": 3821565.8428020044,
                  "compareDate": "2022-11-14",
                  "compareValue": 3720264.032154001,
                  "diff": -101301.8106480036,
                  "isAnomaly": false,
                  "pop": -0.026507932825181484
                }
                "self": []
        }
        ...
    ]
}