1
votes

I am trying to figure out how to parse the Adword API query response without exceptions and one issue that i came across is that sometimes, the data itself contains comma besides the comma between each column. Say i do a query on Adroup, campaign and impression by using

<reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201209">
  <selector>
    <fields>CampaignName</fields>
    <fields>AdgroupName</fields>
    <fields>Impressions</fields>
    <predicates>
      <field>Status</field>
      <operator>IN</operator>
      <values>ENABLED</values>
      <values>PAUSED</values>
    </predicates>
  </selector>
  <reportName>Custom Adgroup Performance Report</reportName>
  <reportType>ADGROUP_PERFORMANCE_REPORT</reportType>
  <dateRangeType>LAST_7_DAYS</dateRangeType>
  <downloadFormat>CSV</downloadFormat>
</reportDefinition>

Since my campaign has comma within the string like below: "Adroup,Campaign,Impressions, Premiun Beer, Beer, Chicago, 1000" where the adgroup is "premium beer" and campaign is "Beer,Chicago". that will cause an issue if we parse this information by using comma. Does anyone know how to solve this problem?

1

1 Answers

0
votes

I think the easiest solution to his is to change the campaign names, so that they don't have commas. You can do this easily with the Adwords Editor. In the campaign overview you can select all the campaigns with commas. By choosing 'replace text' you can replace the comma with hyphens for example.