Statistics differ from the values you can see in ads.twitter.com

ads
analytics

#1

Dear Twitter Ads community:

Our clients are having problems with the statistics/metrics that we show to them in our platform. Ads.twitter.com is currently showing different metrics to those supplied to us via the API.

Here is an example of a twurl request:

$ twurl -H "https://ads-api.twitter.com" "/1/stats/accounts/18ce53vrk7s?entity_ids=5byzj&entity=CAMPAIGN&granularity=DAY&metric_groups=ENGAGEMENT,WEB_CONVERSION,MEDIA,BILLING&placement=ALL_ON_TWITTER&start_time=2016-06-26T23:00:00Z&end_time=2016-06-30T23:00:00Z" | python -m json.tool
{
    "data": [
        {
            "id": "5byzj",
            "id_data": [
                {
                    "metrics": {
                        "app_clicks": null,
                        "billed_charge_local_micro": [
                            266510000,
                            156900000,
                            0,
                            0
                        ],
                        "billed_engagements": [
                            2454,
                            2053,
                            0,
                            0
                        ],
                        "card_engagements": null,
                        "carousel_swipes": null,
                        "clicks": [
                            3946,
                            3175,
                            0,
                            0
                        ],
                        "conversion_custom": {
                            "metric": [
                                583,
                                1009,
                                7,
                                6
                            ],
                            "order_quantity": null,
                            "sale_amount": null
                        },
                        "conversion_downloads": {
                            "metric": null,
                            "order_quantity": null,
                            "sale_amount": null
                        },
                        "conversion_purchases": {
                            "metric": null,
                            "order_quantity": null,
                            "sale_amount": null
                        },
                        "conversion_sign_ups": {
                            "metric": null,
                            "order_quantity": null,
                            "sale_amount": null
                        },
                        "conversion_site_visits": {
                            "metric": null,
                            "order_quantity": null,
                            "sale_amount": null
                        },
                        "engagements": [
                            4014,
                            3235,
                            0,
                            0
                        ],
                        "follows": [
                            15,
                            13,
                            0,
                            0
                        ],
                        "impressions": [
                            356917,
                            361300,
                            0,
                            0
                        ],
                        "likes": [
                            110,
                            85,
                            0,
                            0
                        ],
                        "media_views": null,
                        "qualified_impressions": null,
                        "replies": [
                            14,
                            5,
                            0,
                            0
                        ],
                        "retweets": [
                            39,
                            42,
                            0,
                            0
                        ],
                        "url_clicks": [
                            2707,
                            2183,
                            0,
                            0
                        ]
                    },
                    "segment": null
                }
            ]
        }
    ],
    "data_type": "stats",
    "request": {
        "params": {
            "country": null,
            "end_time": "2016-06-30T23:00:00Z",
            "entity": "CAMPAIGN",
            "entity_ids": [
                "5byzj"
            ],
            "granularity": "DAY",
            "metric_groups": [
                "ENGAGEMENT",
                "WEB_CONVERSION",
                "MEDIA",
                "BILLING"
            ],
            "placement": "ALL_ON_TWITTER",
            "platform": null,
            "segmentation_type": null,
            "start_time": "2016-06-26T23:00:00Z"
        }
    },
    "time_series_length": 4
}

And here the same campaign with the data that we see in ads.twitter.com (start: 2016-06-27 end: 2016-06-30):
http://i.imgur.com/gt86ODk.png

As you can see, for the same campaign and the same range of time:

  • ads.twitter.com for the campaign 5byzj shows a total of 770790 impressions.
  • The API request for the campaign 5byzj returns a total of 718217 impressions.

The same happens for other metrics like engagments, billed_charge_local_micro, etc…

Is it a bug or something that I’m doing wrong?

Cheers!


#2

Hi @k4rliky,

Really good post, It’s really explained.

It’s strange because, we fetch the same metrics but at line_item level and our results only differs in less than 0.1%, and only in the last 3 days.

I recommend you to fetch your stats at line_item level, and see what happens.

As Documentation says:

Do request data (ideally) at the line_items and promoted_tweets level, as you can always aggregate and roll these metrics up to get totals across the entire ads entity hierarchy (i.e. for the campaign, funding instrument or account levels).

Try it!

Thanks!


#3

Hi Hector

I did what you told me and I get the same wrong results:

$ twurl -H "https://ads-api.twitter.com" "/1/stats/accounts/18ce53vrk7s?entity_ids=5jutg&entity=LINE_ITEM&granularity=DAY&metric_groups=ENGAGEMENT,WEB_CONVERSION,MEDIA,BILLING&placement=ALL_ON_TWITTER&start_time=2016-06-26T23:00:00Z&end_time=2016-06-30T23:00:00Z" | python -m json.tool
{
    "data": [
        {
            "id": "5jutg",
            "id_data": [
                {
                    "metrics": {
                        "app_clicks": null,
                        "billed_charge_local_micro": [
                            266510000,
                            156900000,
                            0,
                            0
                        ],
                        "billed_engagements": [
                            2454,
                            2053,
                            0,
                            0
                        ],
                        "card_engagements": null,
                        "carousel_swipes": null,
                        "clicks": [
                            3946,
                            3175,
                            0,
                            0
                        ],
                        "conversion_custom": {
                            "metric": [
                                583,
                                1009,
                                7,
                                6
                            ],
                            "order_quantity": null,
                            "sale_amount": null
                        },
                        "conversion_downloads": {
                            "metric": null,
                            "order_quantity": null,
                            "sale_amount": null
                        },
                        "conversion_purchases": {
                            "metric": null,
                            "order_quantity": null,
                            "sale_amount": null
                        },
                        "conversion_sign_ups": {
                            "metric": null,
                            "order_quantity": null,
                            "sale_amount": null
                        },
                        "conversion_site_visits": {
                            "metric": null,
                            "order_quantity": null,
                            "sale_amount": null
                        },
                        "engagements": [
                            4014,
                            3235,
                            0,
                            0
                        ],
                        "follows": [
                            15,
                            13,
                            0,
                            0
                        ],
                        "impressions": [
                            356917,
                            361300,
                            0,
                            0
                        ],
                        "likes": [
                            110,
                            85,
                            0,
                            0
                        ],
                        "media_views": null,
                        "qualified_impressions": null,
                        "replies": [
                            14,
                            5,
                            0,
                            0
                        ],
                        "retweets": [
                            39,
                            42,
                            0,
                            0
                        ],
                        "url_clicks": [
                            2707,
                            2183,
                            0,
                            0
                        ]
                    },
                    "segment": null
                }
            ]
        }
    ],
    "data_type": "stats",
    "request": {
        "params": {
            "country": null,
            "end_time": "2016-06-30T23:00:00Z",
            "entity": "LINE_ITEM",
            "entity_ids": [
                "5jutg"
            ],
            "granularity": "DAY",
            "metric_groups": [
                "ENGAGEMENT",
                "WEB_CONVERSION",
                "MEDIA",
                "BILLING"
            ],
            "placement": "ALL_ON_TWITTER",
            "platform": null,
            "segmentation_type": null,
            "start_time": "2016-06-26T23:00:00Z"
        }
    },
    "time_series_length": 4
}

So it doesn’t seem to be related with the entity level.

I’m already aware that recent stats could differ from the correct results, but this request is for a campaign that was started in 27 June, which is so long ago…

Thank you again!


#4

Thanks @k4rliky,

It was only an idea… hahaha.

The only thing we know is Twitter Ads API has the same results in campaign and line_item level…

I can’t help you more here. Hopefully someone from Twitter staff could share with us more information, I’ll be here to hear it

You’re right also about the fact that the campaign is old enought to have static metrics.

Thanks!


#5

Can anyone help me? :slight_smile:


#6

@k4rliky are the numbers still off? if so, is this a follower campaign by any chance? see this: Metrics from promoted tweets don't add up to campaign metrics


#7

Hey @obscyuriy
My campaign objective is a WEBSITE_CLICKS one, however, I see the same problem with different objectives, I don’t think that this is related with the kind of objetive.

thanks for your help!


#8

The issue is that you are currently only requesting stats for placement=ALL_ON_TWITTER, which includes stats for placements that are on Twitter, such as Timeline, Search, Profiles, etc. However, this campaign is also serving to the Twitter Audience Platform, and you must request stats for that through an additional call for placement=PUBLISHER_NETWORK. If you aggregate the two, you should get the same results as what your clients see in the UI.

For example, combining results from the query you provided above with the same query but setting placement=TWITTER_AUDIENCE_PLATFORM should give you your expected results :
twurl -H "https://ads-api.twitter.com" "/1/stats/accounts/18ce53vrk7s?entity_ids=5byzj&entity=CAMPAIGN&granularity=DAY&metric_groups=ENGAGEMENT,WEB_CONVERSION,MEDIA,BILLING&placement=PUBLISHER_NETWORK&start_time=2016-06-26T23:00:00Z&end_time=2016-06-30T23:00:00Z"


#9

@hwz I’ll take a look, thank you so much!


#10

Dear @hwz,

I’m facing the same problem again, I’ve tried what you told me, in this case for the ACCOUNT entity, please check this out:

This is the request for placement ALL_ON_TWITTER:

$ twurl -H "https://ads-api.twitter.com" "/1/stats/accounts/18ce53vrk7s?entity_ids=18ce53vrk7s&entity=ACCOUNT&granularity=DAY&metric_groups=ENGAGEMENT,WEB_CONVERSION,MEDIA,BILLING&placement=ALL_ON_TWITTER&start_time=2016-07-21T00:00:00+01:00&end_time=2016-07-24T00:00:00+01:00" | python -m json.tool
{
    "data": [
        {
            "id": "18ce53vrk7s",
            "id_data": [
                {
                    "metrics": {
                        "engagements": [
                            11572,
                            13248,
                            14052
                        ],
                        "follows": [
                            35,
                            49,
                            38
                        ],
                        "impressions": [
                            272176,
                            510328,
                            522408
                        ],
                        "likes": [
                            251,
                            281,
                            292
                        ],
                        "replies": [
                            15,
                            13,
                            20
                        ],
                        "retweets": [
                            50,
                            61,
                            67
                        ]
                    },
                    "segment": null
                }
            ]
        }
    ],
    "data_type": "stats",
    "request": {
        "params": {
            "country": null,
            "end_time": "2016-07-23T23:00:00Z",
            "entity": "ACCOUNT",
            "entity_ids": null,
            "granularity": "DAY",
            "metric_groups": [
                "ENGAGEMENT",
                "WEB_CONVERSION",
                "MEDIA",
                "BILLING"
            ],
            "placement": "ALL_ON_TWITTER",
            "platform": null,
            "segmentation_type": null,
            "start_time": "2016-07-20T23:00:00Z"
        }
    },
    "time_series_length": 3
}

For PUBLISHER_NETWORK placement (No results, everything is null)

$ twurl -H "https://ads-api.twitter.com" "/1/stats/accounts/18ce53vrk7s?entity_ids=18ce53vrk7s&entity=ACCOUNT&granularity=DAY&metric_groups=ENGAGEMENT,WEB_CONVERSION,MEDIA,BILLING&placement=PUBLISHER_NETWORK&start_time=2016-07-21T00:00:00+01:00&end_time=2016-07-24T00:00:00+01:00" | python -m json.tool
{
    "data": [
        {
            "id": "18ce53vrk7s",
            "id_data": [
                {
                    "metrics": {
                        "engagements": null,
                        "follows": null,
                        "impressions": null,
                        "likes": null,
                        "replies": null,
                        "retweets": null
                    },
                    "segment": null
                }
            ]
        }
    ],
    "data_type": "stats",
    "request": {
        "params": {
            "country": null,
            "end_time": "2016-07-23T23:00:00Z",
            "entity": "ACCOUNT",
            "entity_ids": null,
            "granularity": "DAY",
            "metric_groups": [
                "ENGAGEMENT",
                "WEB_CONVERSION",
                "MEDIA",
                "BILLING"
            ],
            "placement": "PUBLISHER_NETWORK",
            "platform": null,
            "segmentation_type": null,
            "start_time": "2016-07-20T23:00:00Z"
        }
    },
    "time_series_length": 3
}

And here you can see the real stats from ads.twitter.com (on the right) and a comparison with out chart (on the left).

How can I get these missing stats?

Also, please notice that your docs say that the enum value is TWITTER_PUBLISHER_NETWORK but the correct value is PUBLISHER_NETWORK (https://dev.twitter.com/ads/basics/enums).

Cheers!


#11

Hi @hwz

I just wanted to give you a heads-up about this issue.

I’ve checked our analytics for the last three days, as we have some campaigns running at the moment, the stats are correct in our platform if I compare them to ads.twitter.com.

However, the stats are still wrong if I check the period mentioned above (start: 2016-07-21T00:00:00+01:00 / end: 2016-07-24T00:00:00+01:00).

The date and timezone for these requests are correct.

Could this be related to the analytics generated by TAP? Is there any way we can get those missing analytics?

Thank you!


#12

Yes. The analytics shown in the ads.twitter.com UI are an aggregate of activity on TAP and Twitter. Thus, you should compare the stats from the UI to the sum of metrics from TAP and All on Twitter from the API


#13

@hwz That’s exactly what we are doing right now, we are aggregating both TAP and All On Twitter metrics, but for the PUBLISHER_NETWORK I always get null response for entity=ACCOUNT.


#14

We are still having this problem, Can anyone help me?
Thanks in advance!


#17

Hi, @k4rliky. Sorry about the delay in getting back to you.

The bug that was causing the null responses has been fixed. For more information, see the Difference in results from v0 to v1 thread—and this post specifically.

Now:

$ twurl -H "https://ads-api.twitter.com" "/1/stats/accounts/18ce53vrk7s?entity_ids=18ce53vrk7s&entity=ACCOUNT&granularity=DAY&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER&start_time=2016-07-21T00:00:00+01:00&end_time=2016-07-24T00:00:00+01:00" | jq
{
  "data_type": "stats",
  "time_series_length": 3,
  "data": [
    {
      "id": "18ce53vrk7s",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": [
              272176,
              510328,
              522408
            ]
            ...
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2016-07-20T23:00:00Z",
      "segmentation_type": null,
      "entity_ids": null,
      "end_time": "2016-07-23T23:00:00Z",
      "country": null,
      "placement": "ALL_ON_TWITTER",
      "granularity": "DAY",
      "entity": "ACCOUNT",
      "platform": null,
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}
$ twurl -H "https://ads-api.twitter.com" "/1/stats/accounts/18ce53vrk7s?entity_ids=18ce53vrk7s&entity=ACCOUNT&granularity=DAY&metric_groups=ENGAGEMENT&placement=PUBLISHER_NETWORK&start_time=2016-07-21T00:00:00+01:00&end_time=2016-07-24T00:00:00+01:00" | jq
{
  "data_type": "stats",
  "time_series_length": 3,
  "data": [
    {
      "id": "18ce53vrk7s",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": [
              29691,
              49947,
              201512
            ]
            ...
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2016-07-20T23:00:00Z",
      "segmentation_type": null,
      "entity_ids": null,
      "end_time": "2016-07-23T23:00:00Z",
      "country": null,
      "placement": "PUBLISHER_NETWORK",
      "granularity": "DAY",
      "entity": "ACCOUNT",
      "platform": null,
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}

Element-wise addition of the impressions arrays: [272176, 510328, 522408] + [29691, 49947, 201512] = [301867, 560275, 723920]. This matches your expected results.

Please confirm that any other stats discrepancies you may have been seeing have been resolved. Thanks!


Also, please note that not all metrics are available for every entity type. At the account-level, only engagement metrics are available. This is the reason I only list metric_groups=ENGAGEMENT in the request. For more information, see the Metrics and Segmentation in Analytics documentation.


#18

@k4rliky: Are the stats discrepancies you were previously seeing now resolved?


#19

Hey @juanshishido! It works perfectly now, thank you so much for your effort on this!


#20