Aggregating campaign report into campaign type

23 views
Skip to first unread message

Nicky Moorhead

unread,
May 11, 2021, 4:47:38 AM5/11/21
to AdWords API and Google Ads API Forum
Hi,

I'm exporting data via a script from the campaign_performance_report. Part of my script looks like this:

function get_data(campaign_dict){
  var perf_data = [["Period","Campaign Type","Engine","Clicks","Impressions","Cost","Conversions","Conversion Value"]]
  var query = "SELECT AdvertisingChannelType, Impressions, Clicks, Cost, Conversions, ConversionValue FROM CAMPAIGN_PERFORMANCE_REPORT WHERE Impressions > 0 DURING LAST_7_DAYS";
   var rows = AdsApp.report(query).rows();
  while(rows.hasNext()){
    var row = rows.next();
    perf_data.push(["This Week",row['AdvertisingChannelType'],"Google",row['Clicks'],row['Impressions'],row['Cost'],row['Conversions'],row['ConversionValue']]);
  }
  return perf_data;
}

I want the data to be aggregated by campaign type which is why I'm not selecting the campaign from the select command but the script is currently returning data for each campaign separetely.

How can I get the data aggregated so the output only has a row for each campaign type?

Thank you.
Nicky 

Google Ads API Forum Advisor Prod

unread,
May 11, 2021, 8:59:19 AM5/11/21
to ni...@tailoreddigitalsolutions.co.uk, adwor...@googlegroups.com
Hi Nicky,

It appears you are using Google Ads Scripts. You can reach out to their team on their forum. They should be able to provide you ways on to aggregate the campaigns by type. 

Regards,
Anthony

Google Logo
Anthony
Google Ads API Team
 


ref:_00D1U1174p._5004Q2H9wP0:ref
Reply all
Reply to author
Forward
0 new messages