Clarification about the logics behind the API metrics derived


#1

Hello guys,

We are developing a routine to fetch and persist data about our clients campaigns daily. We researched all the documentation and started the implementation. This question is just to see if our logic is correct and following the logics you guys implemented behind the API.

We are doing like this:

1 - Fetch all client’s accounts.

2 - Check which accounts are subscribed in our system.

3 - For the accounts subscribed, we check which campaigns IDs are subscribed in our system for the that specific time range (basically figuring out which campaigns we need to fetch)
So far so good. All 100% working till here.

4 - Fetch stats for each campaign:
"/0/stats/accounts/:account_id/campaigns/:id"
When we get the data, our main doubt is how to procede the parsing according with:
https://dev.twitter.com/ads/analytics/metrics-derived
Since the “objective” is on the “line” level (so we dont know the objective of each campaign) and what we want is to get the whole result for the campaign, this is what we are doing:

For impressions, summing the whole combo:
promoted_tweet_search_impressions + promoted_tweet_timeline_impressions + promoted_tweet_profile_impressions

For Total Engagements, summing the whole combo:
promoted_account_follows + promoted_tweet_search_engagements + promoted_tweet_timeline_engagements + promoted_tweet_profile_engagements
+
promoted_tweet_search_clicks + promoted_tweet_search_replies + promoted_tweet_search_retweets + promoted_tweet_search_follows + promoted_tweet_timeline_clicks + promoted_tweet_timeline_replies + promoted_tweet_timeline_retweets + promoted_tweet_timeline_follows + promoted_tweet_profile_clicks + promoted_tweet_profile_replies + promoted_tweet_profile_retweets + promoted_tweet_profile_follows

Is that right?
Basically what we are trying to do is just ignore the “objective” and create an universal parser for whole campaigns.

Tks


#2

Hi there, is there a reason you’re reluctant to go down one level of granularity and fetch stats directly from the line item level? That way, you can take into account the objective and use the appropriate logic to fetch the relevant metrics.


#3

Hello!
The reason would be avoid more requests.
We are getting data from several campaigns in a daily routine to get “big picture” stats. It does not seem to make much sense to go deeper unless you guys say it is mandatory to get accurate results.