Search code examples
facebookfacebook-graph-apifacebook-marketing-api

Setting Conversion Window/Ads Action Stats via Facebook Ads Api


enter image description here

I have a requirement to add 'Conversion Window' (as above) to an existing Java application which creates batches of Facebook ads. I can't find how to set Conversion Window via the API or how to get a list of them from the API.

This is the most relevant information I've found:

https://developers.facebook.com/docs/marketing-api/reference/ads-action-stats

But it doesn't give me all of what I need.


Solution

  • Although named similarly, those are two different things.

    Conversion window specified with bidding is a time period used for optimization of ad delivery. The parameter is called attribution_specand can be set on adset. Valid combinations are described here.

    Adset with conversion window of 1-day view, 7-day click would be specified like this:

    {
       "name": "Adset name",
       "attribution_spec": [
          {
             "event_type": "VIEW_THROUGH",
             "window_days": 1
          },
          {
             "event_type": "CLICK_THROUGH",
             "window_days": 7
          }
       ],
       ... other adset params ...
    }
    

    Attribution window is a parameter used when loading insights. Using that you can get the stats broken down into different time periods, which can be handy for advanced analytics.