从服务器发送线下事件

从 v1.6.0 起,转化 API 网关支持某个特定 API 端点,广告主可通过此端点从他们的服务器将非网站(线下)事件发送至转化 API 网关。这与转化 API 直接方法相似。主要区别在于:通过此端点,事件将流经转化 API 网关,而不是直接发送至 Meta 图谱 API。

发送请求

如要发送新事件,请通过以下路径向此 API 的 /events 连线发出 POST 请求:https://<capig.instance.url>/capi/{PIXEL_ID}/events

向此连线发出该请求时,Meta 即会新建服务器事件。

curl -i -X POST \
  -d '{
  "data": [
    {
      "event_name": "Purchase",
      "event_time": <Unix timestamp in seconds, must be within the last seven days>,
      "user_data": {
        "em": [
          "973dfe463ec85785f5f95af5ba3906eedb2d931c24e69824a89ea65dba4e813b"
        ],
        "ph": [
          "ce3a598687c8d2e5aa6bedad20e059b4a78cca0adad7e563b07998d5cd226b8c"
        ],
        "client_ip_address": "123.123.123.123",
        "client_user_agent": "CLIENT_USER_AGENT",
        "fbc": "fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890",
        "fbp": "fb.1.1558571054389.1098115397"
      },
      "contents": [
        {
          "id": "product123",
          "quantity": 1,
          "delivery_category": "home_delivery"
        }
      ],
      "custom_data": {
        "currency": "usd",
        "value": 123.45
      },
      "event_source_url": "http://test.com/product/123",
      "action_source": "website"
    }
  ]
}' \
https://<capig.instance.url>/capi/<PIXEL_ID>/events