The AdWords API allows applications to interact directly with the AdWords platform. You can build applications to more efficiently manage large or complex AdWords accounts and campaigns. Contrary to the rest of the APIs that we have covered in this series of posts, the Google AdWords API is implemented only using the SOAP protocol. It doesn’t offer a RESTful web implementation.
Nevertheless, they offer a number of client libraries that you can use for your language or framework of choice. They officially support clients in the following languages:
The AdWords API is a complex product that exposes a lot of functionality to the user, ranging from reporting to do the bidding and programmatic advertisement. As this post’s scope is the extraction of data from it, we’ll focus only on that part of the Google AdWords API to load the data to a data warehouse for further analysis.
There are many ways of interacting with the data that adWords API gathers. One way is to link your Google Analytics and AdWords accounts and actually enrich your analytics data with data coming from AdWords. If you have the luxury to afford a Google analytics premium account, the other possible way is to load your data directly to Google BigQuery. From there, you can either do your analysis from BigQuery or export your data to another data warehouse.
We’ll assume that you do not have a Google Analytics premium account, to be honest, if you had you wouldn’t be looking at this post anyway, but you still want to extract data and load it to your own data warehouse solution. To do that, we’ll utilize the Report related functionality of the AdWords API. The API supports a huge number of reports that you can request, and it is possible to change the granularity of your results by passing specific parameters. Defining what kind of data you want to get back as part of your report can be done in two different ways.
- Using an XML-based report definition.
- Using an AWQL-based report definition.
If you want to use an XML-based report definition you have to include a parameter named “__rdxml” that will contain an XML serialized definition of the report you want to retrieve.
<reportName>Custom Adgroup Performance Report</reportName>
AWQL is a SQL-like language for performing queries against most common AdWords API services. Any service with a query method is supported; queryable fields for each service are listed here.
As a comparison you can see the difference between using XML and AWQL below:
CampaignPage p = campaignService.query("SELECT Id, Name
WHERE Status = 'ENABLED'
ORDER BY Name
DESC LIMIT 0,50");
As we can see, the Google AdWords API has a very expressive way of defining what data we want to get from it and various options to do that. If you feel more comfortable with SQL-like languages, you can use AWQL, or if you prefer XML, you can use that for defining your reports.
Regarding the format of the results you get from the API, there are also multiple options supported.
- CSVFOREXCEL – Microsoft Excel compatible format
- CSV – comma separated output format
- TSV – tab separated output format
- XML – xml output format
- GZIPPED-CSV – compressed csv
- GZIPPED-XML – compressed xml
Google AdWords exposes a very rich API which offers you the opportunity to get very granular data about your accounting activities and use it for analytic and reporting purposes. This richness comes with a price though many complex resources have to be handled through an also complex protocol.