I'm pulling ad performance for an entire business account using the Graph explorer and I would like to only pull the data for the ads that have conversion data (i.e. the 'insights' dictionary exists).
My query so far is:
<BUSINESS_ID>?fields=client_ad_accounts{ads{name,insights{impressions,inline_link_clicks,spend}}}
but that gives me the ad IDs for every single ad in each account. Most accounts have more than 2000 ads (most of which are inactive), so it's an unnecessarily large query.
Here is a small snippet from the result of the current query, with only one ad ID actually having performance data:
"ads": {
"data": [
{
"id": "xxxxx"
},
{
"id": "xxxxx"
},
{
"id": "xxxxx"
},
{
"id": "xxxxx"
},
{
"id": "xxxxx"
},
{
"insights": {
"data": [
{
"impressions": "3000",
"spend": "41.24",
"date_start": "2020-03-08",
"date_stop": "2020-04-06"
}
],
I've tried to use
&filtering=[{field: "insights",operator:"IN", value: ["client_ad_accounts.ads"]}]
and other variants thereof to filter out the inactive ads, but none worked. How can I structure the query to cut out the inactive ads?