skip to Main Content

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!

2

Answers


  1. I broke my head with this for quite some time, I ended up sending the Fbp cookie in mine and the cAPI tests began picking up these requests.

    I am actually doing pure offline events so the only parameter I’m sending across is the fbp parameter, action_source = other, event_name and event_time

    Hopefully this helps someone!

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search