Fastest way to segment by city on campaign level



I’m currently trying to breakdown metrics by city. The city segmentation requires a country parameter. In order to retrieve these geoids I first gather the available countries for the campaign, using the locations segmentation. Then I have to do a new request for each of the countries segmented by city.
Is there an easier way to accomplish this?
For instance, can I do a single city segmentation request with multiple country geoids in one request?
Thanks in advance!

A second issue I have come across is that certain segmentation by city does not result in any data for certain countries even though it should be there, because it is in the list given by the locations segmentation.



Could you please give a specific example for the latter problem you point out? (“does not result in any data for certain countries”)

My understanding is that the API for retrieving targeting_criteria/locations is intended to enable user’s targeting selection based upon user filtering/searching (like a UI widget), not to mine a complete list of them, but since they are fairly static you are welcome to try to mine it as much as you can.

If the list of cities you need to be able to look up is smaller than 100 or 200, I would imagine you should be able to find them at least once and store them in a DB table or lookup file on your side instead of having to call the API every time.




Without going into the details of the account I used, I can given an example.

For a specific campaign, I request the billed_charge_local_micro metric, segmented by location. (Because there is basically always a value for this)
This gives me a list of countries, in this case 10 European ones, with their respective billed_charge_local_micro values. (All of them more than 0)
Then, for lack of a better option, I use each of the location_value’s I have just retrieved, one by one, in a query for several metrics I need, segmented by city, platforms and devices.
The result is that for 6 countries I get a list of cities back, with all of these metrics, and for 4 I get not data.

I have tried this for region as well, and the result was that I got data for 5 countries only, the other 5 had no data either.

Thus my main issue is with the lack of data for these countries, because clearly money has been spent on them.

The second issue, is the fact that I have to go through each of these countries separately instead of using a single query.

Any help would be appreciated.



Sorry for the delay in following up with you here.

We would generally recommend that you focus upon Line Item and Tweet level endpoint for overall performance analysis and optimization. The ability to segment by location could influence changing the targeting of a campaign, if you can see that one entire country performs much worse than another one, but for city by city metrics it might make more sense to consider splitting up the campaign per country and have potential for different creative per country for optimal results. Then, the matter of getting stats segmented by LOCATIONS would make a lot more sense and give meaningful result by itself.

It’s not common to do the step you mention and only look up metrics after you have looked up countries, it’s much more common to get all the metrics for each Tweet and Line Item ID you care about and then use segmentation for digging in deeper.

I’m not sure why some countries are not returning data for your query for detailed data, but requesting data segmented by city might have more coarse results than saying “please give me the data split up by location”. If you have a specific example you could share I think you should pull that specific call into Twurl and post it as a new query into this forum.