多账户用转化 API 网关控制平面 API:参考文档

按时间范围获取账户事件指标

在管理员有权管理某个账户的条件下,获取 Pixel 像素代码和事件层级的该账户专用事件指标。

结构

POST https://{capig_domain}/capig/graphql/ 
_________________________________________________________________________________________________________________
      
query HomeViewQuery($tenantId: ID!, $pixelIds: [String!], $timeWindow: Int) {
  tenantQueries(tenantId: $tenantId) {
    eventMetrics(pixelIds: $pixelIds, timeWindowMin: $timeWindow) {
      activity {
        name
        receivedCount
        publishedCount
        lastUpdated
      }
      incoming {
        eventNamesCount
        eventsCount
      }
      outgoing {
        eventNamesCount
        eventsCount
        publishSuccessRate
      }
    }
  }
}
_________________________________________________________________________________________________________
tenantId: ID!
_______________________________________________________________________________________________________
pixelIds: [String!]
_______________________________________________________________________________________________________      
timeWindow: Int
     

字段

字段描述

tenantId
编号

必要

此账户的唯一标识符

pixelIds
字符串

非必要

需要获取事件指标的 Pixel 像素代码编号清单

timeWindow
整数

非必要

时间窗以分钟为单位(默认值为 60 分钟)


返回

EventMetricsSnapshot

字段描述

id
编号

EventMetricsSnapshot 的标识符 — 始终为 EventTrafficSummary:incoming

incoming
EventTrafficSummary

传入事件摘要数据

outgoing
ConversionsApiPublishSummary

传出事件数据

activity
EventActivity

事件动态清单

domainActivity
DomainActivity

网域动态清单


错误代码

代码描述

401

无权查看事件指标

500

内部服务器错误


请求示例

查询

query HomeViewQuery($tenantId: ID!, $pixelIds: [String!], $timeWindow: Int) {
 tenantQueries(tenantId: $tenantId) {
   eventMetrics(pixelIds: $pixelIds, timeWindowMin: $timeWindow) {
     activity {
       name
       receivedCount
       publishedCount
       lastUpdated
     }
     incoming {
       eventNamesCount
       eventsCount
     }
     outgoing {
       eventNamesCount
       eventsCount
       publishSuccessRate
     }
   }
 }
}
     

变量

{
 "tenantId": "IaoreXfj",
 "pixelIds": ["18904456377094531"]
}
     

响应示例

{
   "data": {
       "tenantQueries": {
           "eventMetrics": {
               "activity": [
                   {
                       "name": "Purchase_PN_Mar22_Events",
                       "receivedCount": 4,
                       "publishedCount": 0,
                       "lastUpdated": "1678753252000"
                   }
               ],
               "incoming": {
                   "eventNamesCount": 1,
                   "eventsCount": 4
               },
               "outgoing": {
                   "eventNamesCount": 0,
                   "eventsCount": 0,
                   "publishSuccessRate": 0.0
               }
           }
       }
   }
}