Line Item & Promoted Tweet Metrics are empty for one account

analytics

#1

We have written code to create analytics jobs and then retrieve them (i.e. using POST /1/stats/jobs/accounts/:account_id & GET/1/stats/jobs/accounts/:account_id. Everything works fine for all of our clients’ accounts except one. What we get back for this one account, however, is:

{“data_type”:“stats”,“time_series_length”:30,“data”:[{“id”:“24bqv”,“id_data”:[]},{“id”:“28awd”,“id_data”:[]}, …

Every entity has an empty id_data element.

I have check the start_time/end_time range and these line items/tweets are still active within that range. This is a major car manufacturer so I cannot believe there are no metrics in the last 30 days.


#2

Hi @ChrisNiebel,

Happy to take a look at this for you. Can you include the full GET/POST requests and responses you’re receiving for the account in question, as well as the App ID, preferably using twurl? That will allow us to dig into the account in question.

Thanks much!

Mike


#3

Mike,

I’ve written the code in .NET and use oData to authenticate. Here is the POST to analytics:

https://ads-api.twitter.com/1/stats/jobs/accounts/e3qx2?entity=LINE_ITEM&metric_groups=ENGAGEMENT,MEDIA,BILLING,VIDEO,WEB_CONVERSION,MOBILE_CONVERSION&placement=ALL_ON_TWITTER&entity_ids=skuk,uhyt,vjra,108ly,1hlh2,1hlh8,1hlhi,1hlhq,1hljb,1hlje,1hljx,1hlk5,1mgcq,1mgd1,1mgeh,1mgew,1pmra,1pmrd,1pmrx,1pms2&granularity=DAY&segmentation_type=PLATFORMS&start_time=2017-05-29&end_time=2017-06-28

Then I perform a get status:
https://ads-api.twitter.com/1/stats/jobs/accounts/e3qx2?job_ids=880164798893359105

And ultimately, retrieve the metrics using:
https://ton.twimg.com/advertiser-api-async-analytics/Wz3o4gNKDmIXXyco59-KrKvEOOrjJcmSpvZoFYGM7ISHGHAFXRmHKPvAvVF1YfLuhjkspcsh9JuXX_dSpMneBPZpEXkQ0MfLFBSa4CHvBS7B4DYt-2IrvL8TXKYuAtbq.json.gz

The resulting .JSON after unzipping is:

{  
  "data_type":"stats",
  "time_series_length":30,
  "data":[  
    {  
      "id":"1pmrx",
      "id_data":[  

      ]
    },
    {  
      "id":"uhyt",
      "id_data":[  

      ]
    },
    {  
      "id":"1hlk5",
      "id_data":[  

      ]
    },
    {  
      "id":"108ly",
      "id_data":[  

      ]
    },
    {  
      "id":"1hlh8",
      "id_data":[  

      ]
    },
    {  
      "id":"1hlje",
      "id_data":[  

      ]
    },
    {  
      "id":"1mgd1",
      "id_data":[  

      ]
    },
    {  
      "id":"1hlhi",
      "id_data":[  

      ]
    },
    {  
      "id":"1pmrd",
      "id_data":[  

      ]
    },
    {  
      "id":"vjra",
      "id_data":[  

      ]
    },
    {  
      "id":"1pmra",
      "id_data":[  

      ]
    },
    {  
      "id":"1hlh2",
      "id_data":[  

      ]
    },
    {  
      "id":"1hljx",
      "id_data":[  

      ]
    },
    {  
      "id":"1pms2",
      "id_data":[  

      ]
    },
    {  
      "id":"1hljb",
      "id_data":[  

      ]
    },
    {  
      "id":"1hlhq",
      "id_data":[  

      ]
    },
    {  
      "id":"1mgeh",
      "id_data":[  

      ]
    },
    {  
      "id":"skuk",
      "id_data":[  

      ]
    },
    {  
      "id":"1mgew",
      "id_data":[  

      ]
    },
    {  
      "id":"1mgcq",
      "id_data":[  

      ]
    }
  ],
  "request":{  
    "params":{  
      "start_time":"2017-05-29T07:00:00Z",
      "segmentation_type":"PLATFORMS",
      "entity_ids":[  
        "skuk",
        "uhyt",
        "vjra",
        "108ly",
        "1hlh2",
        "1hlh8",
        "1hlhi",
        "1hlhq",
        "1hljb",
        "1hlje",
        "1hljx",
        "1hlk5",
        "1mgcq",
        "1mgd1",
        "1mgeh",
        "1mgew",
        "1pmra",
        "1pmrd",
        "1pmrx",
        "1pms2"
      ],
      "end_time":"2017-06-28T07:00:00Z",
      "country":null,
      "placement":"ALL_ON_TWITTER",
      "granularity":"DAY",
      "entity":"LINE_ITEM",
      "platform":null,
      "metric_groups":[  
        "ENGAGEMENT",
        "MEDIA",
        "BILLING",
        "VIDEO",
        "WEB_CONVERSION",
        "MOBILE_CONVERSION"
      ]
    }
  }
}

#4

Hi @ChrisNiebel, thanks for the info. Can you let me know where those entity_ids (ie, line_item IDs) are being generated from in your initial POST to the /stats/ endpoint? I’m able to generate a JSON file with metrics using valid line_item IDs from e3qx2, so I suspect there might be an issue with how you are fetching the IDs used in your POST.

Best,

Mike


#5

We obtain them by first getting campaigns:

https://ads-api.twitter.com/1/accounts/e3qx2/campaigns

And then line items from:
https://ads-api.twitter.com/1/accounts/e3qx2/line_items

Thanks.


#6

Mike,

I double checked our code in retrieving the entity IDs (line items) and it works as expected. Again, this works for other clients. It seems odd that the same code would return bad ids for just this client.

Any ideas?
-Chris


#7

Mike,

Any update on this?

-Chris


#8

Hi @ChrisNiebel, apologies for the delay! The three active line_item IDs are:

979xg
97a2u
979yv

When I hit the following endpoint like so, I see all three of them listed:

twurl -H ads-api.twitter.com "/1/accounts/e3qx2/line_items?sort_by=updated_at-desc"

The account in question has a lot of campaigns/line items, so I’m wondering if the active ones you’re looking for are being paginated. You can look at how we handle returning large datasets in our Pagination documentation

Hopefully this helps, but let me know if you continue to encounter any issues.


#9

Mike,

It is not due to pagination. We handle that and are getting line items but not metrics for those line items. Metrics are handled via a POST and Twitter builds the results and we get them back using a GET and receive a GZIPed JSON file. The JSON file Twitter is returning does not include metrics. Now, if metrics are not provided for inactive line items then that would make sense.

Please confirm.

Thanks,
Chris


#10

Mike,

I figured it out. You must look at the line item’s servable property. If it is false, you cannot get metrics on it.

Thanks for your help!

-Chris


#11

@ChrisNiebel Glad to hear it, Chris! If I can help with anything else, please don’t hesitate to let me know.


#12

#13

#14

That’s not necessarily true.

The following campaign is currently paused (entity_status=PAUSED) and is not servable.

$ twurl -H ads-api.twitter.com "/2/accounts/18ce54d4x5t/campaigns?campaign_ids=8yn7m"
{
  "request": {
    "params": {
      "campaign_ids": [
        "8yn7m"
      ],
      "account_id": "18ce54d4x5t"
    }
  },
  "next_cursor": null,
  "data": [
    {
      "name": "batch campaigns",
      "start_time": "2017-07-10T00:00:00Z",
      "reasons_not_servable": [
        "PAUSED_BY_ADVERTISER"
      ],
      "servable": false,
      "daily_budget_amount_local_micro": 140000000,
      "end_time": null,
      "funding_instrument_id": "lygyi",
      "duration_in_days": null,
      "standard_delivery": true,
      "total_budget_amount_local_micro": null,
      "id": "8yn7m",
      "entity_status": "PAUSED",
      "account_id": "18ce54d4x5t",
      "frequency_cap": null,
      "currency": "USD",
      "created_at": "2017-07-07T17:28:50Z",
      "updated_at": "2017-07-07T17:42:17Z",
      "deleted": false
    }
  ]
}

Whether or not I will get non-null metrics depends on what window I’m requesting stats for and when this campaign changed to "servable": false. I could have paused the campaign today, but if I’m requesting stats for yesterday, I could see data.


#15

Thanks for the additional information. I’ll add that as well. I wish Twitter would provide more thorough information on when or not you can get analytics.