Analytics per account



I want to get analytics via Asynchronous Analytics.
I want to get a report with analytics per account, and not per specific ids.
There is a way? I see that entity_ids is required parameter…



Thanks for the question, @esti_fisher.

You are right. entity_ids is a required parameter. It is possible to retrieve ad account-level stats, though. If you are interested in this, you can specify ACCOUNT as the entity and the ad account ID as the entity_ids. Something like:


For reference, see the POST stats/jobs/accounts/:account_id endpoint documentation.

Hope this helps.




Thanks for the fast reply.
I just want to understand, I want to get the analytics per promoted tweets level.
If I set the entity- ACCOUNT, won’t I get the analytics aggrraggated by account level, and not by promoted tweet level?
Is there any way to get analytics by promoted tweet level of all promoted tweets under specific accounts?


Hey @esti_fisher

You can get stats at the promoted tweet level however that requires a few additional steps.

  1. Get all promoted_tweets associated with the given Ads account
  2. Use the entity=PROMOTED_TWEET with the Promoted Tweet IDs from (1) to populate the entity_ids field. Note that the stats endpoint only allows up to 20 entity_ids per request, so if you’ve got more than 20 Promoted Tweets on the Ads account, you’ll need to split up your request.

Hope that helps!


Thanks @imit8me for the clarification.
Request per 20 entities will create large round-trips overhead.
Will this allow fetching data for large accounts in a reasonable time? Especially considering the API Rate Limits.


Hey @Idoweiss

I’m not entirely certain of the question here, however rate limits for our async endpoints are on a per Ads account basis, and most analytics jobs run within 1-2 minutes, so you should enough bandwidth to achieve your goals



To give some context, we’d like to bring analytics in the promoted_tweet level
Twitter allow 8000 line_items per account, so I assume it allows several ten of thousands of promoted_tweets per account.

So for accounts with lets say 20k promoted tweets, we’ll need 1000 API calls to bring analytics data for all of the promoted _tweets, and if on average they will take 1.5 minutes, this adds up to 25 hours. Depending on the account rate limit some of the calls will run in parallel, but still it sound like we’ll need several hours to bring analytics data for large accounts.

Is there a more efficient to bring analytics data per promoted_tweets?


Hey @Idoweiss

That is correct, however the case wherein you’d need to request data for so many entities would be restricted to on boarding a new account to your platform (i.e., an initial import of all the analytics data for Promoted Tweets). This will be a time consuming process, as you’ve pointed out however you’d ideally need to do this once per Ads account.

Once the on boarding is completed, the recommendation here is to request data for entities you know have changed. For example, campaigns that are still in flight (or rather, still within the start_time and end_time).

Let me know if you’ve got any follow up questions or any use cases that aren’t related to on boarding a new Ads account.



Thanks @imit8me for your suggestion.
Our system operate with a high number of customers and onboarding new activities happen continuously so our system doesn’t distinguish between new and existing activities when fetching data.
Anyway we’ll look into your suggestion.