Hi there,

I am able to use python SDK, to pull campaign Async analytics. However response are tagged to an Id pulled from active entities which i believe is campaign_id.

  1. How do we get associated campaign name using same SDK.

  2. I want to segment the result using segment type of POSTAL_CODE and Country… Is there mapping of country code like for US what is code and also same for postal_code.

here is my asyn call:

create async stats jobs and get job ids

queued_job_ids =
for chunk_ids in split_list(ids, 20):
queued_job_ids.append(LineItem.queue_async_stats_job(account, chunk_ids, metric_groups, granularity=granularity, placement=placement, start_time=start_time, end_time=end_time).id)

let the job complete

seconds = 30
time.sleep(seconds)

async_stats_job_results = LineItem.async_stats_job_result(account, job_ids=queued_job_ids)
async_data =
for result in async_stats_job_results:
async_data.append(LineItem.async_stats_job_data(account, url=result.url))
print(async_data

I tried as below, but it returns result as:

“segment”:{
“segment_name”:“Unknown”,
“segment_value”:“0000000000000000”
},

country = '96683cc9126741d1' segmentation_type = 'POSTAL_CODES'

for chunk_ids in split_list(ids, 20):

queued_job_ids.append(LineItem.queue_async_stats_job(account, chunk_ids, metric_groups, granularity=granularity, placement=placement, start_time=start_time, end_time=end_time, country=country, segmentation_type=segmentation_type).id)

However when i tried using segmentation_type=‘METROS’ for country=‘96683cc9126741d1’, i did got segmented result as:

“segment”:{
“segment_name”:“Parkersburg WV, US”,
“segment_value”:“af5f7cc4ddeb4399”
},

so my question is, what are mapping between country and postal_code? seems like there is custom code for each country, where can i find that mapping? like if we want for UK

Thanks,

Hey @pv_panjiyar

Please ignore any values where the segment_name is Unknown as this is a known issue on our end.

Additionally, the full mapping of countries and other location types can be found in the targeting_criteria endpoints.

Thanks!

Hi @imit8me , Thanks for response.

  1. Is there python SDK way to pull this country mappings?All I am looking is countr_code vs country name. I will be using country=‘country_code’ and segmentation_type=‘METROS’

  2. Also, can you help me how do i fetch campaign_name? i am getting id from active_entities, and in response all results are tied to that id (i believe it is campaign_id).