Google AdWords API – Part 5

The last article about Google AdWords API is about how to get additional informations for keywords. For this example we want to know how much turnover a keyword has generated for a special date range (for example a day). This value (totalConvValue) was a part from the AdGroupCriterionService, but is now deprecated. This is the reason we now have to get it from another service.

ReportDefinitionService

Reports can be get from ReportDefinitionService. This works like all other services. The only difference is, that you can only get the whole report as XML or CSV. This is the reason, why it is a bit inconvenient. We have to store the file and the parse it to get the information. The code looks as follows:

We first load our service. Then we create a selector and define what we want from the report service. We set the type of report, which is  KEYWORDS_PERFORMANCE_REPORT. The format is XML. With DownloadReport we get the report and store it into a file on disk. The path and filename  are set by params.

Parse your report

We now have a XML file with our needed data. The last step is to parse the XML file and get the values we want to store into database. This can be done the following way:

Part 1 | Part 2 | Part 3 | Part 4 | Part 6

(Visited 1,287 times, 1 visits today)

1 Response

  1. Calin says:

    Greetings,

    Awesome article on the AdWords API.
    I’m looking for a way to retrieve Feeds or Business data, at least the id’s, in order to modify them. Maybe you have a reference.

    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *