Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Conversion API NOT receiving event

I'm trying to run a test event in Graph API explorer before integrating it to our website.

I'm having a problem not receiving the test event but the response is not showing any error.

{
  "data": [{
    "event_name": "PageView",
    "event_time": 1611631182,
    "action_source": "website",
    "event_source_url": "https://example.com",
    "user_data": {
      "client_ip_address": "1.2.3.4",
      "client_user_agent": "test ua"
    }
  }],
  "test_event_code": "TEST12345"
}

I try to include the Email (em) parameter inside the user_data with the value that is generated by default in Payload Helper. It works fine. But when I generate a different email hash, it's NOT working.

I'm using v9.0 in the API. I hope some could help me solve the problem.

Thanks!

like image 911
MJCaabay Avatar asked Jan 26 '21 06:01

MJCaabay


People also ask

How do I check my conversion API events on Facebook?

Go to Meta Events Manager. Click the Data sources tab on the left-hand side of the Page. Select your pixel. Click Test events.

How does the Facebook conversions API work?

With the conversions API, your website collects the data, the data gets stored on your server, and the data gets sent to Facebook via API. With the pixel, Facebook collects the data (using cookies), the data gets stored on the user's browser, and the data gets sent to Facebook via pixel.

How do you fix purchase event missing some deduplication parameters?

To fix it, FB recommends: "Add an event_id parameter to all Purchase events that you're sending from both your pixel and the Conversions API.


Video Answer


1 Answers

It seems that the user data in your payload needs to contain "real" data.

In your example, try using a real client_user_agent value (like the one below).

Alternatively, are you certain that you're hashing the email correctly? Compare your email hash against a SHA256 hash from this website to ensure you're hashing it correctly.

For example, if you're using JavaScript's crypto library to do the SHA256 hash, you need to use hex encoding, not base64 encoding:

crypto.createHash("sha256").update("[email protected]").digest("hex");

In my case, the events weren't appearing because I hadn't included IP address & user agent in the payload OR I had included the right fields but set an invalid user agent.

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 into providing real data

like image 65
DMeechan Avatar answered Sep 22 '22 19:09

DMeechan