How to get the spending of campaign ad via country & device os type


which api can get the spending of campaign ad via country & device os type?


Hi, @_documentor. You can get segmented analytics through the asynchronous stats endpoint.

Hope this helps!


how do i use country & platform(device os type) segements in the same time to get billing data ?


Hi, @_documentor. It’s not possible to segment by both of these dimensions at the same time.


why line-items which got from Ads api didn’t match campaigns_dashboard list?some line-items was untitled?did any problem accrue?


@_documentor: could you please provide the request and response, preferably using twurl, so that we can see what’s happening? Thanks!


asynchronous stats endpoint can pull campaign spending?which metric_groups?


For spend, you can use the BILLING metric group enum.


why did i request billing of entity which is ACCOUNT, but data fields of job result was empty?
for example:


Hi, @_documentor. Not all metrics are available for every entity type. At the account-level, only engagement metrics are available. Please see the Metrics and Segmentation in Analytics documentation for more information. Thanks!


but how can i query account spend which group by platform?


Hi _documentor, perhaps this page would help as well:

You cannot retrieve billing at account level because you might have different funding instruments with different currencies (one with USD, another with JPY, etc).

Those listed in link above are the recommended metric groups - you can attempt to retrieve any metric_group for any objective because it depends upon which entity and creative is being promoted (for example, videos will have media metrics).

Hope this makes sense!


why data didn’t match?data which pull from api less then ads campaigns_dashboard?
api which i used is “stats/jobs/accounts/:account_id” and segmenting data by HOUR granularity~~


@_documentor: Please type out the request and the response you received as well as the values you were expecting for each of the hours. We need to this information to determine whether there is a discrepancy or not. Thanks a lot!


request params(PHP): [metric_groups] => BILLING [start_time] => 2016-08-31T00:00:00+08:00 [end_time] => 2016-09-01T00:00:00+08:00 [granularity] => HOUR [entity] => CAMPAIGN [entity_ids] => 5siai,5sibq,5sid8,5sidu,5sies,5sifa,5sigs,5sihc,5siht,5sikf,5sj0e,5sj0q,5sj3y,5sj5c,5sj60,5sj6i,5sj6y,5sj7l,5sj85 [placement] => ALL_ON_TWITTER [segmentation_type] => PLATFORMS

{“data_type”:“stats”,“time_series_length”:24,“data”:[{“id”:“5siai”,“id_data”:[]},{“id”:“5siht”,“id_data”:[{“segment”:{“segment_name”:“iOS devices”,“segment_value”:“0”},“metrics”:{“billed_charge_local_micro”:[0,0,0,0,0,190000,0,0,0,70000,0,0,0,0,0,0,0,0,0,0,0,0,0,0],“billed_engagements”:[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}]},{“id”:“5sihc”,“id_data”:[]},{“id”:“5sidu”,“id_data”:[{“segment”:{“segment_name”:“iOS devices”,“segment_value”:“0”},“metrics”:{“billed_charge_local_micro”:[610000,0,0,0,310000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],“billed_engagements”:[1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}]},{“id”:“5sj6y”,“id_data”:[]},{“id”:“5sj0q”,“id_data”:[]},{“id”:“5sj5c”,“id_data”:[]},{“id”:“5sikf”,“id_data”:[]},{“id”:“5sid8”,“id_data”:[]},{“id”:“5sj0e”,“id_data”:[]},{“id”:“5sj60”,“id_data”:[]},{“id”:“5sj7l”,“id_data”:[]},{“id”:“5sj6i”,“id_data”:[]},{“id”:“5sigs”,“id_data”:[]},{“id”:“5sj3y”,“id_data”:[]},{“id”:“5sibq”,“id_data”:[]},{“id”:“5sifa”,“id_data”:[]},{“id”:“5sj85”,“id_data”:[]},{“id”:“5sies”,“id_data”:[]}],“request”:{“params”:{“start_time”:“2016-08-30T16:00:00Z”,“segmentation_type”:“PLATFORMS”,“entity_ids”:[“5siai”,“5sibq”,“5sid8”,“5sidu”,“5sies”,“5sifa”,“5sigs”,“5sihc”,“5siht”,“5sikf”,“5sj0e”,“5sj0q”,“5sj3y”,“5sj5c”,“5sj60”,“5sj6i”,“5sj6y”,“5sj7l”,“5sj85”],“end_time”:“2016-08-31T16:00:00Z”,“country”:null,“placement”:“ALL_ON_TWITTER”,“granularity”:“HOUR”,“entity”:“CAMPAIGN”,“platform”:null,“metric_groups”:[“BILLING”]}}}


@_documentor: It will be much be easier to look at a single campaign. Could you pick one and let us know what values you were expecting for each of the hours?


campaign name is “1MTXZ-ROS-UK-PokemonGO-IOS-OAB-08/23”,day :2016-08-31


@_documentor: Are the values at the top (e.g., [0] => int(610000)) what you are expecting to see from the Ads UI or is that what you’re getting as the response? Please let me know and I’ll take a look.


campaigns_dashboard had three columns($0.61, $0.31, $0.01),but data which pull from api did have two(610000, 310000).lose one!!!


Not a single case