How to retrieve stats for deleted promoted tweets? [it's not working as expected]

stats
promoted-tweets

#1

We are trying to retrieve stats for deleted promoted tweets but not getting metrics returned. Note we get stats for the parent line items of the deleted promoted tweets that are returning no metrics.

We are using v2 APIs:
https://ads-api.twitter.com/2/stats/accounts/:account_id
entity= PROMOTED_TWEET
(can post full payload if helpful)

Question - is it possible to get stats for deleted promoted tweets?


#2

Yes, it is possible to retrieve stats for deleted entities. Note that you’re likely to see null values if you request data where your start_time is after the entity was deleted.


#3

Hi thanks for the response - we are getting null returned for all metrics when querying for deleted promoted tweets.

Here is an example:

If we pull stats at line_item level for line_item_id=9p5pf it had impressions=8707985 for 23-dec. It has total 7 promoted tweets (6-deleted and 1-active) and the active promoted tweet has impressions=2379.
Below are the steps we have taken:

  1. We fetched promoted tweets by line item 9p5pf

url = ‘https://ads-api.twitter.com/2/accounts/18ce54aoia6/promoted_tweets?line_item_ids=9p5pf&with_deleted=true

response:

{
    "request": {
        "params": {
            "count": 1000,
            "with_total_count": true,
            "line_item_ids": ["9p5pf"],
            "account_id": "18ce54aoia6",
            "with_deleted": true
        }
    },
    "next_cursor": null,
    "data": [{
        "line_item_id": "9p5pf",
        "id": "1gnr5r",
        "entity_status": "ACTIVE",
        "created_at": "2017-08-16T22:11:42Z",
        "updated_at": "2017-08-21T06:46:53Z",
        "approval_status": "ACCEPTED",
        "tweet_id": "895167447212404736",
        "deleted": true
    }, {
        "line_item_id": "9p5pf",
        "id": "1gnr5s",
        "entity_status": "ACTIVE",
        "created_at": "2017-08-16T22:11:42Z",
        "updated_at": "2017-08-16T22:43:45Z",
        "approval_status": "ACCEPTED",
        "tweet_id": "895164782738907137",
        "deleted": true
    }, {
        "line_item_id": "9p5pf",
        "id": "1gnr5t",
        "entity_status": "ACTIVE",
        "created_at": "2017-08-16T22:11:42Z",
        "updated_at": "2017-08-16T22:43:45Z",
        "approval_status": "ACCEPTED",
        "tweet_id": "895164641629941764",
        "deleted": true
    }, {
        "line_item_id": "9p5pf",
        "id": "1gnr5u",
        "entity_status": "ACTIVE",
        "created_at": "2017-08-16T22:11:42Z",
        "updated_at": "2017-08-16T22:43:45Z",
        "approval_status": "ACCEPTED",
        "tweet_id": "895164515133923328",
        "deleted": true
    }, {
        "line_item_id": "9p5pf",
        "id": "1gnrkh",
        "entity_status": "ACTIVE",
        "created_at": "2017-08-16T22:43:45Z",
        "updated_at": "2017-08-21T06:46:50Z",
        "approval_status": "ACCEPTED",
        "tweet_id": "895167836221575170",
        "deleted": true
    }, {
        "line_item_id": "9p5pf",
        "id": "1gnrki",
        "entity_status": "ACTIVE",
        "created_at": "2017-08-16T22:43:45Z",
        "updated_at": "2017-08-21T06:46:49Z",
        "approval_status": "ACCEPTED",
        "tweet_id": "895167604419178496",
        "deleted": true
    }, {
        "line_item_id": "9p5pf",
        "id": "1gtupy",
        "entity_status": "ACTIVE",
        "created_at": "2017-08-21T06:46:42Z",
        "updated_at": "2017-08-21T12:14:44Z",
        "approval_status": "ACCEPTED",
        "tweet_id": "899521243224788994",
        "deleted": false
    }],
    "total_count": 7
}

From response only one promoted tweet is ‘ACTIVE’ and not deleted, the other 6 are with deleted status true.

2. Then we tried to fetch promoted tweets stats for all above promoted tweets for date 23-12-2017 hourly breakdown

url = 'https://ads-api.twitter.com/2/stats/accounts/18ce54aoia6?end_time=2017-12-24T00%3A00%3A00-08&metric_groups=ENGAGEMENT%2CBILLING%2CWEB_CONVERSION%2CMOBILE_CONVERSION%2CMEDIA%2CVIDEO&entity=PROMOTED_TWEET&start_time=2017-12-23T00%3A00%3A00-08&placement=PUBLISHER_NETWORK&entity_ids=1gnr5r%2C1gnr5s%2C1gnr5t%2C1gnr5u%2C1gnrkh%2C1gnrki%2C1gtupy&granularity=HOUR'

In this response we have stats for only active promoted tweet i.e 1gtupy for others we got null values.
If we sum up hourly impressions for active promoted tweet then it is impressions=2379

response below had 5/6 deleted tweet responses removed due to character limits in thread but they were all identical with nulls for every metric

{
	"data_type": "stats",
	"time_series_length": 24,
	"data": [{
		"id": "1gnrkh",
		"id_data": [{
			"segment": null,
			"metrics": {
				"video_views_50": null,
				"impressions": null,
				"mobile_conversion_spent_credits": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_installs": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_content_views": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_add_to_wishlists": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_checkouts_initiated": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"tweets_send": null,
				"conversion_purchases": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"mobile_conversion_reservations": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_add_to_wish_list": null,
				"mobile_conversion_tutorials_completed": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"billed_charge_local_micro": null,
				"qualified_impressions": null,
				"video_views_75": null,
				"conversion_sign_ups": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"media_engagements": null,
				"auto_created_conversion_sign_up_initiated": null,
				"follows": null,
				"auto_created_conversion_download": null,
				"mobile_conversion_achievements_unlocked": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"video_3s100pct_views": null,
				"auto_created_conversion_content_view": null,
				"app_clicks": null,
				"mobile_conversion_searches": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_checkout_initiated": null,
				"mobile_conversion_site_visits": {
					"order_quantity": null,
					"post_view": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"retweets": null,
				"mobile_conversion_key_page_views": {
					"post_engagement": null,
					"post_view": null
				},
				"auto_created_conversion_added_payment_info": null,
				"video_cta_clicks": null,
				"likes": null,
				"mobile_conversion_add_to_carts": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_payment_info_additions": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_complete_registration": null,
				"mobile_conversion_re_engages": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"video_content_starts": null,
				"video_views_25": null,
				"mobile_conversion_shares": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"conversion_site_visits": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"engagements": null,
				"conversion_custom": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"auto_created_conversion_add_to_cart": null,
				"video_views_100": null,
				"clicks": null,
				"mobile_conversion_sign_ups": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_purchase": null,
				"media_views": null,
				"card_engagements": null,
				"auto_created_conversion_page_view": null,
				"poll_card_vote": null,
				"auto_created_conversion_search": null,
				"replies": null,
				"url_clicks": null,
				"video_mrc_views": null,
				"mobile_conversion_purchases": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_rates": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_logins": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"billed_engagements": null,
				"mobile_conversion_updates": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"conversion_downloads": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"mobile_conversion_levels_achieved": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_downloads": {
					"post_view": null,
					"post_engagement": null,
					"order_quantity": null,
					"sale_amount": null
				},
				"video_total_views": null,
				"mobile_conversion_invites": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"carousel_swipes": null
			}
		}]
	}, {
		"id": "1gtupy",
		"id_data": [{
			"segment": null,
			"metrics": {
				"video_views_50": [6, 0, 0, 0, 1, 15, 54, 77, 81, 123, 98, 124, 103, 156, 166, 219, 89, 86, 85, 81, 53, 71, 58, 31],
				"impressions": [9, 1, 1, 0, 2, 20, 66, 89, 106, 137, 124, 177, 149, 222, 234, 296, 126, 117, 120, 122, 74, 83, 69, 35],
				"mobile_conversion_spent_credits": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_installs": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_content_views": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_add_to_wishlists": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_checkouts_initiated": {
					"post_view": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
					"order_quantity": null,
					"assisted": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
					"post_engagement": null,
					"sale_amount": null
				},
				"tweets_send": null,
				"conversion_purchases": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"mobile_conversion_reservations": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_add_to_wish_list": null,
				"mobile_conversion_tutorials_completed": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"billed_charge_local_micro": null,
				"qualified_impressions": null,
				"video_views_75": [6, 0, 0, 0, 1, 15, 54, 76, 77, 120, 92, 122, 102, 152, 158, 218, 87, 85, 82, 77, 52, 70, 57, 31],
				"conversion_sign_ups": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"media_engagements": null,
				"auto_created_conversion_sign_up_initiated": null,
				"follows": null,
				"auto_created_conversion_download": null,
				"mobile_conversion_achievements_unlocked": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"video_3s100pct_views": [9, 1, 1, 0, 2, 20, 59, 89, 105, 137, 119, 175, 144, 222, 228, 286, 125, 115, 116, 117, 73, 83, 69, 35],
				"auto_created_conversion_content_view": null,
				"app_clicks": [0, 0, 0, 0, 0, 1, 3, 0, 0, 2, 1, 5, 2, 5, 9, 11, 2, 2, 1, 2, 1, 0, 0, 0],
				"mobile_conversion_searches": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_checkout_initiated": null,
				"mobile_conversion_site_visits": {
					"order_quantity": null,
					"post_view": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"retweets": null,
				"mobile_conversion_key_page_views": {
					"post_engagement": null,
					"post_view": null
				},
				"auto_created_conversion_added_payment_info": null,
				"video_cta_clicks": [0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 4, 2, 5, 6, 2, 1, 1, 1, 2, 1, 0, 0, 0],
				"likes": null,
				"mobile_conversion_add_to_carts": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_payment_info_additions": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_complete_registration": null,
				"mobile_conversion_re_engages": {
					"post_view": [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0],
					"order_quantity": null,
					"assisted": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
					"post_engagement": [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0],
					"sale_amount": null
				},
				"video_content_starts": [9, 1, 1, 0, 2, 20, 61, 88, 111, 137, 123, 174, 146, 221, 232, 296, 125, 114, 114, 122, 70, 83, 69, 35],
				"video_views_25": [7, 1, 0, 0, 1, 17, 57, 79, 90, 126, 103, 133, 114, 173, 187, 243, 98, 94, 94, 89, 56, 73, 61, 32],
				"mobile_conversion_shares": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"conversion_site_visits": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"engagements": [0, 0, 0, 0, 0, 1, 3, 0, 0, 2, 1, 5, 2, 5, 9, 11, 2, 2, 1, 2, 1, 0, 0, 0],
				"conversion_custom": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"auto_created_conversion_add_to_cart": null,
				"video_views_100": [2, 0, 0, 0, 1, 9, 32, 54, 38, 67, 60, 77, 55, 88, 91, 140, 47, 39, 37, 37, 35, 46, 31, 11],
				"clicks": [0, 0, 0, 0, 0, 1, 3, 0, 0, 2, 1, 5, 2, 5, 9, 11, 2, 2, 1, 2, 1, 0, 0, 0],
				"mobile_conversion_sign_ups": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_purchase": null,
				"media_views": [9, 1, 1, 0, 2, 20, 60, 89, 107, 137, 122, 174, 144, 221, 227, 288, 125, 116, 118, 118, 72, 83, 68, 35],
				"card_engagements": null,
				"auto_created_conversion_page_view": null,
				"poll_card_vote": null,
				"auto_created_conversion_search": null,
				"replies": null,
				"url_clicks": [0, 0, 0, 0, 0, 1, 3, 0, 0, 2, 1, 5, 2, 5, 9, 11, 2, 2, 1, 2, 1, 0, 0, 0],
				"video_mrc_views": [9, 1, 1, 0, 2, 20, 60, 89, 107, 137, 122, 174, 144, 221, 227, 288, 125, 116, 118, 118, 72, 83, 68, 35],
				"mobile_conversion_purchases": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_rates": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_logins": {
					"post_view": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"billed_engagements": null,
				"mobile_conversion_updates": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"conversion_downloads": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"mobile_conversion_levels_achieved": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_downloads": {
					"post_view": null,
					"post_engagement": null,
					"order_quantity": null,
					"sale_amount": null
				},
				"video_total_views": [9, 1, 1, 0, 2, 20, 60, 89, 107, 137, 122, 174, 144, 221, 227, 288, 125, 116, 118, 118, 72, 83, 68, 35],
				"mobile_conversion_invites": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"carousel_swipes": null
			}
		}]
	}],
	"request": {
		"params": {
			"start_time": "2017-12-23T08:00:00Z",
			"segmentation_type": null,
			"entity_ids": ["1gnr5r", "1gnr5s", "1gnr5t", "1gnr5u", "1gnrkh", "1gnrki", "1gtupy"],
			"end_time": "2017-12-24T08:00:00Z",
			"country": null,
			"placement": "PUBLISHER_NETWORK",
			"granularity": "HOUR",
			"entity": "PROMOTED_TWEET",
			"platform": null,
			"metric_groups": ["ENGAGEMENT", "BILLING", "WEB_CONVERSION", "MOBILE_CONVERSION", "MEDIA", "VIDEO"]
		}
	}
}

  1. Then we tried to fetch line item stats for 9p5pf to compare promoted tweet stats for date 23-12-2017 hourly breakdown

url = ‘https://ads-api.twitter.com/2/stats/accounts/18ce54aoia6?end_time=2017-12-24T00%3A00%3A00-08&metric_groups=ENGAGEMENT%2CBILLING%2CWEB_CONVERSION%2CMOBILE_CONVERSION%2CMEDIA%2CVIDEO&entity=LINE_ITEM&start_time=2017-12-23T00%3A00%3A00-08&placement=PUBLISHER_NETWORK&entity_ids=9p5pf&granularity=HOUR

In this response if we sum up the impressions then it shows impressions=8707985

{
	"data_type": "stats",
	"time_series_length": 24,
	"data": [{
		"id": "9p5pf",
		"id_data": [{
			"segment": null,
			"metrics": {
				"video_views_50": [6, 0, 0, 0, 1, 15, 54, 77, 81, 123, 98, 124, 103, 156, 166, 219, 89, 86, 85, 81, 53, 71, 58, 31],
				"impressions": [35532, 4623, 1155, 2030, 3062, 82606, 266376, 327136, 417095, 472983, 538185, 567424, 577385, 595863, 649959, 707710, 323771, 364959, 442178, 526525, 535830, 418218, 403664, 443716],
				"mobile_conversion_spent_credits": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_installs": {
					"post_view": [3, 5, 5, 3, 7, 1, 7, 12, 12, 12, 14, 10, 13, 16, 14, 11, 6, 19, 11, 10, 14, 21, 12, 3],
					"order_quantity": null,
					"assisted": [12, 2, 5, 1, 0, 3, 4, 6, 8, 11, 6, 5, 13, 11, 3, 8, 14, 15, 13, 10, 5, 7, 6, 6],
					"post_engagement": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],
					"sale_amount": null
				},
				"mobile_conversion_content_views": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_add_to_wishlists": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_checkouts_initiated": {
					"post_view": [8, 10, 8, 8, 12, 17, 12, 19, 14, 19, 23, 27, 20, 19, 29, 19, 36, 34, 42, 36, 20, 37, 22, 19],
					"order_quantity": null,
					"assisted": [3, 1, 1, 0, 0, 1, 0, 2, 3, 3, 1, 1, 2, 6, 0, 2, 4, 2, 5, 3, 5, 0, 2, 2],
					"post_engagement": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0],
					"sale_amount": null
				},
				"tweets_send": null,
				"conversion_purchases": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": [1, 1, 1, 1, 1, 0, 1, 0, 3, 2, 3, 3, 3, 2, 2, 1, 1, 1, 2, 1, 0, 9, 2, 3],
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": [1, 1, 1, 1, 1, 0, 1, 0, 3, 2, 3, 3, 3, 2, 2, 1, 1, 1, 2, 1, 0, 9, 2, 3],
					"order_quantity_view": null
				},
				"mobile_conversion_reservations": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_add_to_wish_list": null,
				"mobile_conversion_tutorials_completed": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"billed_charge_local_micro": [128524212, 67501563, 94242300, 42632051, 81128867, 9635630, 92371337, 161411769, 222480698, 214603215, 196313332, 106293925, 281629589, 284299259, 164119185, 161457596, 179588535, 343542670, 247152565, 180746161, 212971498, 256250525, 205803528, 81658525],
				"qualified_impressions": null,
				"video_views_75": [6, 0, 0, 0, 1, 15, 54, 76, 77, 120, 92, 122, 102, 152, 158, 218, 87, 85, 82, 77, 52, 70, 57, 31],
				"conversion_sign_ups": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"media_engagements": null,
				"auto_created_conversion_sign_up_initiated": null,
				"follows": null,
				"auto_created_conversion_download": null,
				"mobile_conversion_achievements_unlocked": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"video_3s100pct_views": [9, 1, 1, 0, 2, 20, 59, 89, 105, 137, 119, 175, 144, 222, 228, 286, 125, 115, 116, 117, 73, 83, 69, 35],
				"auto_created_conversion_content_view": null,
				"app_clicks": [7, 2, 1, 0, 0, 7, 64, 48, 62, 98, 102, 127, 117, 134, 148, 186, 93, 84, 101, 138, 147, 93, 62, 71],
				"mobile_conversion_searches": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_checkout_initiated": null,
				"mobile_conversion_site_visits": {
					"order_quantity": null,
					"post_view": [1, 0, 0, 1, 1, 0, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 2, 3, 3, 0, 4, 2, 2],
					"post_engagement": null,
					"sale_amount": null
				},
				"retweets": null,
				"mobile_conversion_key_page_views": {
					"post_engagement": null,
					"post_view": null
				},
				"auto_created_conversion_added_payment_info": null,
				"video_cta_clicks": [0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 4, 2, 5, 6, 2, 1, 1, 1, 2, 1, 0, 0, 0],
				"likes": null,
				"mobile_conversion_add_to_carts": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_payment_info_additions": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_complete_registration": null,
				"mobile_conversion_re_engages": {
					"post_view": [37, 33, 26, 27, 30, 53, 63, 69, 65, 74, 75, 65, 74, 66, 90, 86, 89, 100, 104, 91, 82, 72, 60, 56],
					"order_quantity": null,
					"assisted": [16, 7, 7, 7, 13, 10, 17, 16, 21, 15, 18, 13, 10, 22, 13, 15, 18, 21, 14, 15, 20, 14, 10, 12],
					"post_engagement": [1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0],
					"sale_amount": null
				},
				"video_content_starts": [9, 1, 1, 0, 2, 20, 61, 88, 111, 137, 123, 174, 146, 221, 232, 296, 125, 114, 114, 122, 70, 83, 69, 35],
				"video_views_25": [7, 1, 0, 0, 1, 17, 57, 79, 90, 126, 103, 133, 114, 173, 187, 243, 98, 94, 94, 89, 56, 73, 61, 32],
				"mobile_conversion_shares": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"conversion_site_visits": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": [1, 0, 0, 1, 1, 0, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 2, 3, 3, 0, 4, 2, 2],
					"order_quantity": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": [1, 0, 0, 1, 1, 0, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 2, 3, 3, 0, 4, 2, 2],
					"order_quantity_view": null
				},
				"engagements": [7, 2, 1, 0, 0, 7, 64, 48, 62, 98, 102, 127, 117, 134, 148, 186, 93, 84, 101, 138, 147, 93, 62, 71],
				"conversion_custom": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"auto_created_conversion_add_to_cart": null,
				"video_views_100": [2, 0, 0, 0, 1, 9, 32, 54, 38, 67, 60, 77, 55, 88, 91, 140, 47, 39, 37, 37, 35, 46, 31, 11],
				"clicks": [7, 2, 1, 0, 0, 7, 64, 48, 62, 98, 102, 127, 117, 134, 148, 186, 93, 84, 101, 138, 147, 93, 62, 71],
				"mobile_conversion_sign_ups": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"auto_created_conversion_purchase": null,
				"media_views": [9, 1, 1, 0, 2, 20, 60, 89, 107, 137, 122, 174, 144, 221, 227, 288, 125, 116, 118, 118, 72, 83, 68, 35],
				"card_engagements": null,
				"auto_created_conversion_page_view": null,
				"poll_card_vote": null,
				"auto_created_conversion_search": null,
				"replies": null,
				"url_clicks": [7, 2, 1, 0, 0, 7, 64, 48, 62, 98, 102, 127, 117, 134, 148, 186, 93, 84, 101, 138, 147, 93, 62, 71],
				"video_mrc_views": [9, 1, 1, 0, 2, 20, 60, 89, 107, 137, 122, 174, 144, 221, 227, 288, 125, 116, 118, 118, 72, 83, 68, 35],
				"mobile_conversion_purchases": {
					"post_view": [1, 1, 1, 1, 1, 0, 1, 0, 3, 2, 3, 3, 3, 2, 2, 1, 1, 1, 2, 1, 0, 9, 2, 3],
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_rates": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_logins": {
					"post_view": [4, 3, 2, 4, 3, 6, 4, 11, 9, 11, 12, 9, 16, 13, 12, 6, 13, 12, 10, 16, 6, 11, 4, 10],
					"order_quantity": null,
					"assisted": [3, 1, 0, 0, 0, 0, 1, 1, 1, 3, 2, 1, 0, 1, 1, 2, 1, 0, 10, 2, 2, 4, 0, 1],
					"post_engagement": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
					"sale_amount": null
				},
				"billed_engagements": [13, 7, 9, 4, 7, 2, 10, 16, 22, 21, 19, 14, 27, 27, 16, 18, 18, 35, 23, 19, 20, 28, 19, 9],
				"mobile_conversion_updates": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"conversion_downloads": {
					"order_quantity_engagement": null,
					"sale_amount_engagement": null,
					"sale_amount_view": null,
					"post_view": null,
					"order_quantity": null,
					"post_engagement": null,
					"sale_amount": null,
					"metric": null,
					"order_quantity_view": null
				},
				"mobile_conversion_levels_achieved": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"mobile_conversion_downloads": {
					"post_view": null,
					"post_engagement": null,
					"order_quantity": null,
					"sale_amount": null
				},
				"video_total_views": [9, 1, 1, 0, 2, 20, 60, 89, 107, 137, 122, 174, 144, 221, 227, 288, 125, 116, 118, 118, 72, 83, 68, 35],
				"mobile_conversion_invites": {
					"post_view": null,
					"order_quantity": null,
					"assisted": null,
					"post_engagement": null,
					"sale_amount": null
				},
				"carousel_swipes": null
			}
		}]
	}],
	"request": {
		"params": {
			"start_time": "2017-12-23T08:00:00Z",
			"segmentation_type": null,
			"entity_ids": ["9p5pf"],
			"end_time": "2017-12-24T08:00:00Z",
			"country": null,
			"placement": "PUBLISHER_NETWORK",
			"granularity": "HOUR",
			"entity": "LINE_ITEM",
			"platform": null,
			"metric_groups": ["ENGAGEMENT", "BILLING", "WEB_CONVERSION", "MOBILE_CONVERSION", "MEDIA", "VIDEO"]
		}
	}
}

#4

Question is

  1. How we calculate aggregated line item impressions stats ?
  2. If line item stats are aggregated stats of promoted tweets then for above response stats are not matching. If not then how to calculate aggregated data of line item and promoted tweet ?

#5

Hi @juanshishido,

Did you get any chance to look at above queries ? Let me know if you require any additional info.


#6

Any update on above queries ?


#7

Thanks for following up, @ampushdev. I plan to look at this tomorrow afternoon.


#8

Hi, @ampushdev. Thanks again for providing this information. I am able to repro. It’s not clear why it’s happening, though. Is this type of discrepancy isolated to just this line_item and its promoted_tweets? I suspect it’s an issue with the data for this particular entity.


For completeness, let me list the four possible requests. Note that I’m only looking at the ENGAGEMENT metric group since we’re only focused on impressions at the moment.

ALL_ON_TWITTER at the line_items level:

$ twurl -H ads-api.twitter.com "/2/stats/accounts/18ce54aoia6?entity=LINE_ITEM&entity_ids=9p5pf&start_time=2017-12-23&end_time=2017-12-24&metric_groups=ENGAGEMENT&granularity=TOTAL&placement=ALL_ON_TWITTER"
{
  "data_type": "stats",
  "time_series_length": 1,
  "data": [
    {
      "id": "9p5pf",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": [
              2892
            ],
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": [
              17
            ],
            "retweets": null,
            "likes": [
              4
            ],
            "engagements": [
              25
            ],
            "clicks": [
              8
            ],
            "card_engagements": [
              17
            ],
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2017-12-23T08:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "9p5pf"
      ],
      "end_time": "2017-12-24T08:00:00Z",
      "country": null,
      "placement": "ALL_ON_TWITTER",
      "granularity": "TOTAL",
      "entity": "LINE_ITEM",
      "platform": null,
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}

ALL_ON_TWITTER at the promoted_tweets level:

$ twurl -H ads-api.twitter.com "/2/stats/accounts/18ce54aoia6?entity=PROMOTED_TWEET&entity_ids=1gnr5r,1gnr5s,1gnr5t,1gnr5u,1gnrkh,1gnrki,1gtupy&start_time=2017-12-23&end_time=2017-12-24&metric_groups=ENGAGEMENT&granularity=TOTAL&placement=ALL_ON_TWITTER"
{
  "data_type": "stats",
  "time_series_length": 1,
  "data": [
    {
      "id": "1gnrkh",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gtupy",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": [
              2892
            ],
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": [
              17
            ],
            "retweets": null,
            "likes": [
              4
            ],
            "engagements": [
              25
            ],
            "clicks": [
              8
            ],
            "card_engagements": [
              17
            ],
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gnr5t",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gnr5r",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gnr5s",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gnrki",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gnr5u",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2017-12-23T08:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "1gnr5r",
        "1gnr5s",
        "1gnr5t",
        "1gnr5u",
        "1gnrkh",
        "1gnrki",
        "1gtupy"
      ],
      "end_time": "2017-12-24T08:00:00Z",
      "country": null,
      "placement": "ALL_ON_TWITTER",
      "granularity": "TOTAL",
      "entity": "PROMOTED_TWEET",
      "platform": null,
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}

PUBLISHER_NETWORK at the line_items level:

$ twurl -H ads-api.twitter.com "/2/stats/accounts/18ce54aoia6?entity=LINE_ITEM&entity_ids=9p5pf&start_time=2017-12-23&end_time=2017-12-24&metric_groups=ENGAGEMENT&granularity=TOTAL&placement=PUBLISHER_NETWORK"
{
  "data_type": "stats",
  "time_series_length": 1,
  "data": [
    {
      "id": "9p5pf",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": [
              8707985
            ],
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": [
              1892
            ],
            "retweets": null,
            "likes": null,
            "engagements": [
              1892
            ],
            "clicks": [
              1892
            ],
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": [
              1892
            ],
            "carousel_swipes": null
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2017-12-23T08:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "9p5pf"
      ],
      "end_time": "2017-12-24T08:00:00Z",
      "country": null,
      "placement": "PUBLISHER_NETWORK",
      "granularity": "TOTAL",
      "entity": "LINE_ITEM",
      "platform": null,
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}

PUBLISHER_NETWORK at the promoted_tweets level:

$ twurl_ads -A "X-As-User: STARZ" "/2/stats/accounts/18ce54aoia6?entity=PROMOTED_TWEET&entity_ids=1gnr5r,1gnr5s,1gnr5t,1gnr5u,1gnrkh,1gnrki,1gtupy&start_time=2017-12-23&end_time=2017-12-24&metric_groups=ENGAGEMENT&granularity=TOTAL&placement=PUBLISHER_NETWORK" | jq
{
  "data_type": "stats",
  "time_series_length": 1,
  "data": [
    {
      "id": "1gnrkh",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gtupy",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": [
              2379
            ],
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": [
              47
            ],
            "retweets": null,
            "likes": null,
            "engagements": [
              47
            ],
            "clicks": [
              47
            ],
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": [
              47
            ],
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gnr5t",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gnr5r",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gnr5s",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gnrki",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    },
    {
      "id": "1gnr5u",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2017-12-23T08:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "1gnr5r",
        "1gnr5s",
        "1gnr5t",
        "1gnr5u",
        "1gnrkh",
        "1gnrki",
        "1gtupy"
      ],
      "end_time": "2017-12-24T08:00:00Z",
      "country": null,
      "placement": "PUBLISHER_NETWORK",
      "granularity": "TOTAL",
      "entity": "PROMOTED_TWEET",
      "platform": null,
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}

To summarize, we see 2,892 impressions for ALL_ON_TWITTER—which matches between line_items and promoted_tweets—but, for PUBLISHER_NETWORK, we see 8,707,985 impressions for line_items and only 2,379 impressions for promoted_tweets.


How we calculate aggregated line item impressions stats ?
If line item stats are aggregated stats of promoted tweets then for above response stats are not matching. If not then how to calculate aggregated data of line item and promoted tweet ?

The way you calculate line_items stats is by aggregating the data for all of the promoted_tweets under that line item—you have the right idea. Which requests you make depends on the line item’s placement. For example, when your placement is only on Twitter (any of: timeline, profile, search), you only need to make the ALL_ON_TWITTER request. Sometimes you’ll need to make both ALL_ON_TWITTER and PUBLISHER_NETWORK and sometimes you’ll only need to make the PUBLISHER_NETWORK request.


I’ll wait to hear back from you on whether you’re seeing discrepancies for other line items. The team here will try and continue to determine what the issue might be. If it’s a one-off, it may be difficult to prioritize.

Thanks again.


#9

Thanks @juanshishido for response. Yes we found same issue with other line item as well.
We were fetching stats for both placements ALL_ON_TWITTER and PUBLISHER_NETWORK.

For line item ‘9p69k’ we have only one promoted tweet id ‘1gtunz’ which is active.

url = “https://ads-api.twitter.com/2/accounts/18ce54aoia6/promoted_tweets?line_item_ids=9p69k

response:

{  
   "request":{  
      "params":{  
         "account_id":"18ce54aoia6",
         "line_item_ids":[  
            "9p69k"
         ]
      }
   },
   "next_cursor":null,
   "data":[  
      {  
         "line_item_id":"9p69k",
         "id":"1gtunz",
         "entity_status":"ACTIVE",
         "created_at":"2017-08-21T06:39:16Z",
         "updated_at":"2017-08-21T12:14:44Z",
         "approval_status":"ACCEPTED",
         "tweet_id":"899521243224788994",
         "deleted":false
      }
   ]
}

url = “https://ads-api.twitter.com/2/stats/accounts/18ce54aoia6?{}”.format(urlencode(params))

Line item stats

  1. ALL_ON_TWITTER

params = {
“entity_ids”: “9p69k”,
“entity”: “LINE_ITEM”,
“granularity”: “DAY”,
“start_time”: ‘2017-12-23T00:00:00-08’,
“end_time”: ‘2017-12-24T00:00:00-08’,
“metric_groups”: ‘ENGAGEMENT’,
“placement”: ‘ALL_ON_TWITTER’,

}

response:

{  
   "data_type":"stats",
   "time_series_length":1,
   "data":[  
      {  
         "id":"9p69k",
         "id_data":[  
            {  
               "segment":null,
               "metrics":{  
                  "impressions":[  
                     1605
                  ],
                  "tweets_send":null,
                  "qualified_impressions":null,
                  "follows":null,
                  "app_clicks":[  
                     3
                  ],
                  "retweets":null,
                  "likes":[  
                     2
                  ],
                  "engagements":[  
                     13
                  ],
                  "clicks":[  
                     6
                  ],
                  "card_engagements":[  
                     3
                  ],
                  "poll_card_vote":null,
                  "replies":null,
                  "url_clicks":null,
                  "carousel_swipes":null
               }
            }
         ]
      }
   ],
   "request":{  
      "params":{  
         "start_time":"2017-12-23T08:00:00Z",
         "segmentation_type":null,
         "entity_ids":[  
            "9p69k"
         ],
         "end_time":"2017-12-24T08:00:00Z",
         "country":null,
         "placement":"ALL_ON_TWITTER",
         "granularity":"DAY",
         "entity":"LINE_ITEM",
         "platform":null,
         "metric_groups":[  
            "ENGAGEMENT"
         ]
      }
   }
}
  1. PUBLISHER_NETWORK

params = {
“entity_ids”: “9p69k”,
“entity”: “LINE_ITEM”,
“granularity”: “DAY”,
“start_time”: ‘2017-12-23T00:00:00-08’,
“end_time”: ‘2017-12-24T00:00:00-08’,
“metric_groups”: ‘ENGAGEMENT’,
“placement”: ‘PUBLISHER_NETWORK’,

}

response:

{  
   "data_type":"stats",
   "time_series_length":1,
   "data":[  
      {  
         "id":"9p69k",
         "id_data":[  
            {  
               "segment":null,
               "metrics":{  
                  "impressions":[  
                     2230159
                  ],
                  "tweets_send":null,
                  "qualified_impressions":null,
                  "follows":null,
                  "app_clicks":[  
                     3459
                  ],
                  "retweets":null,
                  "likes":null,
                  "engagements":[  
                     3459
                  ],
                  "clicks":[  
                     3459
                  ],
                  "card_engagements":null,
                  "poll_card_vote":null,
                  "replies":null,
                  "url_clicks":[  
                     3459
                  ],
                  "carousel_swipes":null
               }
            }
         ]
      }
   ],
   "request":{  
      "params":{  
         "start_time":"2017-12-23T08:00:00Z",
         "segmentation_type":null,
         "entity_ids":[  
            "9p69k"
         ],
         "end_time":"2017-12-24T08:00:00Z",
         "country":null,
         "placement":"PUBLISHER_NETWORK",
         "granularity":"DAY",
         "entity":"LINE_ITEM",
         "platform":null,
         "metric_groups":[  
            "ENGAGEMENT"
         ]
      }
   }
}

So total number of impressions at LINE_ITEM = 1605 + 2230159 = 2231764

Promoted tweet stats

  1. ALL_ON_Twitter

params = {
“entity_ids”: “1gtunz”,
“entity”: “PROMOTED_TWEET”,
“granularity”: “DAY”,
“start_time”: ‘2017-12-23T00:00:00-08’,
“end_time”: ‘2017-12-24T00:00:00-08’,
“metric_groups”: ‘ENGAGEMENT’,
“placement”: ‘ALL_ON_TWITTER’,

}

response:

{  
   "data_type":"stats",
   "time_series_length":1,
   "data":[  
      {  
         "id":"1gtunz",
         "id_data":[  
            {  
               "segment":null,
               "metrics":{  
                  "impressions":[  
                     1605
                  ],
                  "tweets_send":null,
                  "qualified_impressions":null,
                  "follows":null,
                  "app_clicks":[  
                     3
                  ],
                  "retweets":null,
                  "likes":[  
                     2
                  ],
                  "engagements":[  
                     13
                  ],
                  "clicks":[  
                     6
                  ],
                  "card_engagements":[  
                     3
                  ],
                  "poll_card_vote":null,
                  "replies":null,
                  "url_clicks":null,
                  "carousel_swipes":null
               }
            }
         ]
      }
   ],
   "request":{  
      "params":{  
         "start_time":"2017-12-23T08:00:00Z",
         "segmentation_type":null,
         "entity_ids":[  
            "1gtunz"
         ],
         "end_time":"2017-12-24T08:00:00Z",
         "country":null,
         "placement":"ALL_ON_TWITTER",
         "granularity":"DAY",
         "entity":"PROMOTED_TWEET",
         "platform":null,
         "metric_groups":[  
            "ENGAGEMENT"
         ]
      }
   }
}
  1. PUBLISHER_NETWORK

params = {
“entity_ids”: “1gtunz”,
“entity”: “PROMOTED_TWEET”,
“granularity”: “DAY”,
“start_time”: ‘2017-12-23T00:00:00-08’,
“end_time”: ‘2017-12-24T00:00:00-08’,
“metric_groups”: ‘ENGAGEMENT’,
“placement”: ‘PUBLISHER_NETWORK’,

}

response:

{  
   "data_type":"stats",
   "time_series_length":1,
   "data":[  
      {  
         "id":"1gtunz",
         "id_data":[  
            {  
               "segment":null,
               "metrics":{  
                  "impressions":[  
                     806
                  ],
                  "tweets_send":null,
                  "qualified_impressions":null,
                  "follows":null,
                  "app_clicks":[  
                     48
                  ],
                  "retweets":null,
                  "likes":null,
                  "engagements":[  
                     48
                  ],
                  "clicks":[  
                     48
                  ],
                  "card_engagements":null,
                  "poll_card_vote":null,
                  "replies":null,
                  "url_clicks":[  
                     48
                  ],
                  "carousel_swipes":null
               }
            }
         ]
      }
   ],
   "request":{  
      "params":{  
         "start_time":"2017-12-23T08:00:00Z",
         "segmentation_type":null,
         "entity_ids":[  
            "1gtunz"
         ],
         "end_time":"2017-12-24T08:00:00Z",
         "country":null,
         "placement":"PUBLISHER_NETWORK",
         "granularity":"DAY",
         "entity":"PROMOTED_TWEET",
         "platform":null,
         "metric_groups":[  
            "ENGAGEMENT"
         ]
      }
   }
}

So total number of impressions at PROMOTED_TWEETS = 1605 + 806 = 2411

Difference between line item and promoted tweet stats is very large 2229353.

Yes this issue happens with 'PUBLISHER_NETWORK’ placement. Could you please let me know if you want any info from our side.


#10

@ampushdev: Appreciate you adding this additional detail. It’s quite helpful. Are there any other things you’ve noticed for campaigns with this discrepancy? We know it happens with PUBLISHER_NETWORK, but not every line item that’s got PUBLISHER_NETWORK experiences this, right? Just trying to narrow this down a bit.

We’ll continue looking into why this is happening.

Thanks again!


#11

@ampushdev: One of my colleagues mentioned media creatives. This line item has a few:

$ twurl -H ads-api.twitter.com "/2/accounts/18ce54aoia6/media_creatives?line_item_id=9p5pf"
{
  "request": {
    "params": {
      "account_id": "18ce54aoia6",
      "line_item_id": "9p5pf"
    }
  },
  "next_cursor": null,
  "data": [
    {
      "line_item_id": "9p5pf",
      "landing_url": "",
      "serving_status": "ACTIVE",
      "id": "1do6p",
      "created_at": "2017-08-16T22:11:42Z",
      "account_media_id": "2uaop",
      "updated_at": "2018-01-11T16:15:43Z",
      "approval_status": "ACCEPTED",
      "deleted": false
    },
    {
      "line_item_id": "9p5pf",
      "landing_url": "",
      "serving_status": "ACTIVE",
      "id": "1do6q",
      "created_at": "2017-08-16T22:11:42Z",
      "account_media_id": "2uaoq",
      "updated_at": "2018-01-11T16:15:43Z",
      "approval_status": "ACCEPTED",
      "deleted": false
    },
    {
      "line_item_id": "9p5pf",
      "landing_url": "",
      "serving_status": "ACTIVE",
      "id": "1do6r",
      "created_at": "2017-08-16T22:11:42Z",
      "account_media_id": "2uap5",
      "updated_at": "2018-01-11T16:15:43Z",
      "approval_status": "ACCEPTED",
      "deleted": false
    }
  ]
}

This is why we see a difference between the line_item and promoted_tweets. Unfortunately, we don’t currently have a way to retrieve this data via the API. When your line items include media creatives, you’ll need to pull stats at the line item level to get a complete picture. I hope this helps clarify things.

Thanks again.