0
votes

Hi fellow stackoverflowers! :)

I am wiring my application with adwords API, and want it to display reports based on the retrieved data. My problem is that I am using test account that have no data that could be used for reporting, and so far us I understand testing account don`t provide any. According to the https://developers.google.com/adwords/api/docs/test-accounts#developing_with_test_accounts I should fake data. I am totally fine writing tests and feed then with fixtures, expect I can't find any relevant example of how the response XML will look like so I can create my own fixtures.

For example: I want to pull campaign performance report, and segment it by Week

<reportDefinition>
    <selector>
      <fields>CampaignId</fields>
      <fields>Clicks</fields>
      <fields>Impressions</fields>
      <fields>Week</fields>
      <predicates>
        <field>CampaignId</field>
        <operator>EQUALS</operator>
        <values>111111</values>
      </predicates>
      <dateRange>
        <min>20150201</min>
        <max>20150601</max>
      </dateRange>
    </selector>
    <reportName>Campaign Performance Report NAme</reportName>
    <reportType>CAMPAIGN_PERFORMANCE_REPORT</reportType>
    <dateRangeType>CUSTOM_DATE</dateRangeType>
    <downloadFormat>XML</downloadFormat>
    <includeZeroImpressions>true</includeZeroImpressions>
</reportDefinition>

Which gives me response:

<report>
<report-name name="Campaign Performance Report NAme" />
<date-range date="Feb 1, 2015-Jun 1, 2015" />
<table>
  <columns>
    <column name="campaignID" display="Campaign ID" />
    <column name="clicks" display="Clicks" />
    <column name="impressions" display="Impressions" />
    <column name="week" display="Week" />
  </columns>
</table>

What will be the response with actual data? How it is going to look like in case segmentation will be set to: Date, Month, Quarter, Year?

I have tried to find any xml example on the web and github without luck. Can you please share response examples or point me to the doc, where it says how can I "generate" data for my test acount? Thank you!

2

2 Answers

0
votes

eolexe, I am assuming you did not receive an error for the Campaign Performance Report you tried to fetch. If that is the case then that means there was no match for the predicates and date range you had entered. This why you do not have the rows element within the XML. Also some attributes are are not filterable. But I am pretty sure the CampaignID is. Take a close look at the API just to be sure. You need to migrate to version 201502 because 201402 is deprecated and 201409's sunset day is in July.

0
votes

I have been working on AdWords API for reporting purpose for years, and I can tell you up till now there is still no official sample XML or CSV given. So I simply test the program using real account data...

I don't pick XML as the response type so I cannot really address your question, but you may wish to know that the XML response does not return a total row. That's why I always pick CSV/TSV format.