Right way to pull stats via API so that it matches UI

ads

#1

I wanted to know what would be the right way to pull in spend via the Ads API so that I cover all the campaigns that had delivery within a specific time period.
Say, I pull in spend for the past 5 days via twitter UI, the internal API calls twitter uses gives me the spend pertaining to all the campaigns that had delivery during the last 5 days.
However in the API, I have to first provide a list of entity_ids (campaign IDs) to the stats endpoint, and I have no clue as to which entity_ids had delivery during the above time period of 5 days.


#2

Can anyone help me here?


#3

Hi,

There is currently no easy way to strictly filter to entities that have had spend, but we strongly recommend to use a simple logic like:

  • Was the campaign, line-item active? (where active means not deleted, not paused, not expired)
  • For billing data, you do not need to keep re-fetching it after a certain period of time

Please refer to https://dev.twitter.com/ads/analytics/best-practices for the best practices we pointed to in the past.

If the objective is related to conversions (website conversions, or app conversions with MACT tracking partner) - you need to look at the window settings of web_event_tag and app_event_tag and fetch data even after the campaign stopped serving for those conversion analytics data.

By the way, pulling entities themselves, you should sync with similar filtering like checking the last_updated_at date.