Search code examples
facebookfacebook-graph-api

Get events from Facebook Graph API


When we create a Custom Conversion with FB Graph API, we can define the event name param. I'm trying to find how can I get first my Custom Events, and then select some custom event to parse to event name. How can I do it? Take a look at Custom Conversions docs: https://developers.facebook.com/docs/marketing-api/reference/custom-conversion/v17.0


Solution

  • My own solution: I used the Ads Pixel Stats endpoint, that you can see here: https://developers.facebook.com/docs/marketing-api/reference/ads-pixel/stats/v17.0

    Basically, I made a request to /{ads-pixel-id}/stats endpoint by passing the aggregation param with event_total_counts value:

    https://graph.facebook.com/v17.0/{ads-pixel-id}/stats?aggregation=event_total_counts

    That will returns a list of active events (custom and standard) for the pixel with a count of occurrences. Do you can also parse another params, as you can see in the documentation above.