ADS API end point to get line item audience metrics (report)


#1

Hi,

Can we have ads api end points to get audience metrics (report) of specific line item. Metrics of Locations, Genders, Languages, Platforms, Interests, Ages which are displaying in ad management page.

Thanks in Advance.

Thanks
Sandeep.S


#2

For this, you’ll want to use our asynchronous analytics endpoints and specify a segmentation_type.


#3

@juanshishido

Thanks for the response.

I had tried with the below request

twurl -X POST -H “ads-api.twitter.com” "/4/stats/jobs/accounts/18ce54sj2ha?entity=LINE_ITEM&entity_ids=db78q&start_time=2018-12-25&end_time=2018-12-31&granularity=DAY&placement=ALL_ON_TWITTER&metric_groups=ENGAGEMENT&segmentation_type=GENDER

and return below response

{
  "request": {
    "params": {
      "start_time": "2018-12-24T18:00:00Z",
      "segmentation_type": "GENDER",
      "entity_ids": [
        "db78q"
      ],
      "end_time": "2018-12-30T18:00:00Z",
      "placement": "ALL_ON_TWITTER",
      "granularity": "DAY",
      "entity": "LINE_ITEM",
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  },
  "data": {
    "start_time": "2018-12-24T18:00:00Z",
    "segmentation_type": "GENDER",
    "url": null,
    "id_str": "1081091272478081024",
    "entity_ids": [
      "db78q"
    ],
    "end_time": "2018-12-30T18:00:00Z",
    "country": null,
    "placement": "ALL_ON_TWITTER",
    "id": 1081091272478081024,
    "expires_at": null,
    "account_id": "18ce54sj2ha",
    "status": "PROCESSING",
    "granularity": "DAY",
    "entity": "LINE_ITEM",
    "created_at": "2019-01-04T07:33:39Z",
    "platform": null,
    "updated_at": "2019-01-04T07:33:39Z",
    "metric_groups": [
      "ENGAGEMENT"
    ]
  }
}

Which does not match with twitter ads management tool data.

Thanks in advance.

Thanks,
Sandeep.S


#4

Make sure to request both placement types (if relevant for the specified line items). This has been mentioned in this forum before.


#5

yes

mentioned as below

entity=LINE_ITEM
entity_ids=db78q
granularity=TOTAL
placement=ALL_ON_TWITTER
metric_groups=ENGAGEMENT
segmentation_type=GENDER
start_time=2018-12-25
end_time=2018-12-31

But still does not return gender information.

Below is the line item information

[bid_type] => AUTO
[advertiser_user_id] => 846807524296790016
[name] => VVR Ad Group
[placements] => Array
(
[0] => ALL_ON_TWITTER
)

                [start_time] => 
                [bid_amount_local_micro] => 
                [automatically_select_bid] => 1
                [advertiser_domain] => 
                [target_cpa_local_micro] => 
                [primary_web_event_tag] => 
                [charge_by] => ENGAGEMENT
                [product_type] => PROMOTED_TWEETS
                [end_time] => 
                [bid_unit] => ENGAGEMENT
                [total_budget_amount_local_micro] => 1000000
                [objective] => TWEET_ENGAGEMENTS
                [id] => db78q
                [entity_status] => PAUSED
                [account_id] => 18ce54sj2ha
                [optimization] => DEFAULT
                [categories] => Array
                    (
                    )

                [currency] => USD
                [created_at] => 2018-12-28T06:54:07Z
                [tracking_tags] => Array
                    (
                    )

                [updated_at] => 2019-01-03T12:41:48Z
                [include_sentiment] => ALL
                [campaign_id] => bxmoe
                [creative_source] => MANUAL
                [deleted] => 

Thanks,
Sandeep.S


#6

After you’re making the POST request to the asynchronous analytics endpoints what are you doing? How are you getting the actual metrics?


#7

Request Format :

twurl -X POST -H “ads-api.twitter.com” "/4/stats/jobs/accounts/18ce54sj2ha?entity=LINE_ITEM&entity_ids=db78q&start_time=2018-12-25&end_time=2018-12-31&granularity=DAY&placement=ALL_ON_TWITTER&metric_groups=ENGAGEMENT&segmentation_type=GENDER

Response Data :

{
  "request": {
    "params": {
      "start_time": "2018-12-24T18:00:00Z",
      "segmentation_type": "GENDER",
      "entity_ids": [
        "db78q"
      ],
      "end_time": "2018-12-30T18:00:00Z",
      "placement": "ALL_ON_TWITTER",
      "granularity": "DAY",
      "entity": "LINE_ITEM",
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  },
  "data": {
    "start_time": "2018-12-24T18:00:00Z",
    "segmentation_type": "GENDER",
    "url": null,
    "id_str": "1081091272478081024",
    "entity_ids": [
      "db78q"
    ],
    "end_time": "2018-12-30T18:00:00Z",
    "country": null,
    "placement": "ALL_ON_TWITTER",
    "id": 1081091272478081024,
    "expires_at": null,
    "account_id": "18ce54sj2ha",
    "status": "PROCESSING",
    "granularity": "DAY",
    "entity": "LINE_ITEM",
    "created_at": "2019-01-04T07:33:39Z",
    "platform": null,
    "updated_at": "2019-01-04T07:33:39Z",
    "metric_groups": [
      "ENGAGEMENT"
    ]
  }
}

How can get gender information of the specific line item, which was listed in ads management page below

Thanks in advance,

Thanks,
Sandeep.S


#8

I think it might help to take a step back and understand the workflow for our asynchronous analytics endpoints. There are several steps that need to be taken. This post explains each of them. After you create the job, which you’ve already done*, you must actually download the gzipped file (once it’s ready), unzip it, and check the contents.

* You’ve only created the job, but I don’t see subsequent steps where you’re actually retrieving the data.


#9

@juanshishido Thanks for the response and link provided.


#10

@juanshishido Thank you so much for your response and issue resolved.


#11

Thanks for letting us know. Glad it helped!