如何使用Facebook像素发送event_id?
我收到来自 Facebook 的错误消息:
购买事件缺少您发送的一些重复数据删除参数
通过您的 Pixel 像素代码和转化 API 购买事件,但它们没有被正确删除重复数据,因为没有足够的这些事件接收 event_id 参数。没有 event_id 参数发送的事件实例无法进行重复数据删除。
将 event_id 参数添加到您从像素和转化 API 发送的所有购买事件。要将 event_id 参数添加到您通过 Conversions API 发送的事件,您可以使用 Facebook for Developers 网站上的 Payload Helper 工具来验证您的负载设置是否正确。要将 event_id 参数添加到您通过 Pixel 发送的事件,请进入您网站的源代码并将 event_id 参数添加到您的每个购买事件实例。
但是我在我的像素事件中发送 event_id 进行购买!
回答
使用Conversions API在服务器上发送 event_id 的正确方法是在同一级别,event_name而不是在user_data或内部custom_data。
但是,对于客户端上的像素,您需要像这样将其作为第三个参数发送给 fbq。
fbq('track', 'Purchase', {value: 12, currency: 'USD'}, {eventID: 'purchase.123456'});
请注意,它eventID 在从 pixel而不是发送时被调用event_id。尽管有错误消息调用它event_id!在撰写本文时,这是我能找到描述的第三个参数的唯一页面。
您可以通过单击事件的“查看详细信息”然后查看“事件重复数据删除”在事件管理器工具中进行验证。它将确认从像素接收到参数。它可能不会在几个小时内显示在这里,甚至直到第二天 - 即使您看到实时接收的事件。
- It can be whatever you want! You just need to send the SAME ID on the client and server to represent the same AddToCart event. You could do something simple to start like `const event_id = 'ATC_' + new Date().getTime();` and send that value to both APIs. Unless you are running Amazon.com you probably don't have two people adding to cart the same millisecond - but add a session id or other random number to be sure. Another way would be to call your server to log the event and return a server generated ID which you then pass to Facebook's API - if you do this make sure it returns quickly.