I am implementing Facebook Conversion API on server to capture sales done via a shopping cart on a different site. I call FB API from PHP code using cURL. Here is my payload:
[
{
"event_name":"Purchase",
"event_time":1621701565,
"event_id":1621701565,
"action_source":"website",
"event_source_url":"https://www.example.com",
"user_data":{
"em":"f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a",
"fn":"532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25",
"ln":"9e7cd9cb5a63a3591e16f4d835f32a1c4a84ab66e39ae27aa448c03b66bf63e7",
"client_user_agent":"Chrome",
"client_ip_address":"1.2.3.4"
},
"custom_data":{
"currency":"USD",
"value":"20.00",
"content_ids":"PQ001"
}
}
]
When I submit it, I am getting back this response:
{"events_received":1,"messages":[],"fbtrace_id":"A9n8IBhVwl5gZTB4CCvSG7q"}
However, I do not see the event when I look at my pixel in the Event Manager. I tried using the test_event_code parameter - same story. Did anyone encounter such problem? It looks like everything was submitted OK, but where are the events?
I had the exact same issue when using a dummy user agent value and IP address. It turns out that the user data in your payload needs to contain "real" data.
In your example, the problem may be the Chrome value in your client_user_agent field.
Try using a real client_user_agent value (like the one below).
This payload works for me:
{
"data": [
{
"event_name": "TestEvent",
"event_time": 1627574182,
"action_source": "email",
"user_data": {
"em": "f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a",
"client_ip_address": "254.254.254.254",
"client_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0"
}
}
],
"test_event_code": "TEST43514"
}
Note: you'll need to update the test_event_code and event_time fields (because the Conversions API only accepts events sent in the last 7 days)
Credit to Matěj's answer on the Facebook Developers Community forums for providing a working example payload and the insight that Facebook mysteriously ignores test requests with dummy data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With