facebook-graph-api - Fabebook 像素测试服务器事件
问题描述
我正在尝试使用 Graph API 测试 Facebook 像素的服务器事件。我收到了这个回复。
{
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_subcode": 2804019,
"is_transient": false,
"error_user_title": "Server Side Api Parameter Error",
"error_user_msg": "Unexpected key \"email\" on param \"$['data'][0]\".",
"fbtrace_id": "Ajfq0hd3gzSkADpWdh9210O"
}
}
谁能帮我解决我做错了什么?
解决方案
,test_event_code
应该以相同的令牌方式发送。
php示例:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://graph.facebook.com/v12.0/YOUR_PIXEL_ID/events',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('data' => '[{"event_name": "CompleteRegistration","event_id": "ev.123","event_time": "1633709956","action_source": "website", "user_data": {"client_ip_address": "70.80.XXX.XXX","client_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Mobile/15E148 Safari/604.1"},"custom_data": {"currency": "USD","value": 0.5,"websiteurl": "megaodds.net"}}]','access_token' => 'YOUR_TOKEN','test_event_code' => 'TEST86091'),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
推荐阅读
- node.js - ECS 任务失败:npm Err
- jmeter - NameError:生成 jmeter 报告时未定义名称“unicode”
- python - Queue.get() 内存泄漏
- java - 为什么邮递员在我的 get 请求中多次向我返回相同的对象?春天
- bash - 在 bash 中使用 uniq 在排序时获取重复项
- python - 如何将多个pyspark sql查询合并到同一张表中成为一个查询
- javascript - 如何从 js.erb (rails) 获取位于 config / credantials.yml.enc 文件中的 api_key?
- c# - 如何在不使用 Report.SetParameters() 的情况下将参数从 VB.NET 传递到 SSRS 报告
- nuxt.js - Nuxt 自定义加载指示器 - 如何显示资产文件夹中的图像
- java - getTime() 只返回分钟和秒