Search code examples
restfacebookfacebook-graph-apiadsfacebook-conversions-api

Conversion API Purchase Event does't work


dear community!

I've encountered an issue while implementing the Conversion API integration on our website to track events and send them directly to Facebook from our server. We're experiencing problems specifically with the Purchase event.

What's particularly strange is that all event data appears correctly in the Ad Campaign table, except for the Purchase event. I've conducted test events, verified them in the Payload Helper, and everything appears to be configured correctly for optimization. However, optimization for the Purchase event continues to not work and seems to be completely ignored.

{
  "data": [
    {
      "event_name": "Purchase",
      "event_time": 1695216450,
      "action_source": "website",
      "user_data": {
        "fbc": "fb.0.1695212450117.IwAR1yF9Jrf90FbSgflM_pJRYTgh7ZT3oymnFlrUNO40QTk86-UEnYSphNxF8_aem_AZOepfI1kP3x3UsCPVTzJ-MO0HygQ-6Vsk3yB8LwOV9PYzzhhWIYg7V1Ej4KBmwoYRxT1-6r0d7nyKtGcEiMibxh",
        "fbp": "fb.0.1695216450118.3823645",
        "country": [
          "02b0850aeac58c2cc82413170cdaf7ab69c28a00f04a8ee5744b52cd92c621e1"
        ],
        "client_ip_address": null,
        "client_user_agent": "Mozilla/5.0 (Linux; Android 12; Symphony Z60 Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/117.0.0.0 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/432.0.0.29.102;]"
      },
      "event_source_url": "https://somelink.com",
      "custom_data": {
        "value": 9.87,
        "currency": "USD"
      }
    }
  ]
}

enter image description here


Solution

  • I found the solution. The issue was that after the very first event from the user, I wasn't saving fbc and fbp. Instead, for each new event, I was sending new values for fbc and fbp, which is incorrect!

    Once you receive the first event and respond to Facebook for the first time, you need to save fbc and fbp for all subsequent events related to the person who clicked on a specific ad campaign.