By Rudderstack Team

How to load data from AdWords to Google BigQuery

This post helps you with loading your data from Google AdWords to BigQuery. Suppose you are looking to get analytics-ready data without the manual hassle. In that case, you can integrate Google AdWords to BigQuery with RudderStack, so you can focus on what matters, getting value out of your business data.

Data extraction from Google AdWords

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, and 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 for the following languages

  • Java
  • .Net
  • PHP
  • PERL
  • Python
  • Ruby

The AdWords API is a quite complex product that exposes many functionalities to the user, ranging from reporting to do the bidding and programmatic advertisement. As the scope of this post is the extraction of data out of it, to load any data to a data warehouse for further analysis, we’ll focus only on that part of the Google AdWords API.

There are many ways of interacting with data that adWords API gathers. One way is to link your Google Analytics and AdWords accounts and enrich your analytics data with data coming from AdWords. The other possible way, if you have the luxury to afford a Google analytics premium account, is to load every data directly to Google BigQuery. From there, you can either do your analysis from BigQuery or export 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 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.

  1. Using an XML-based report definition.
  2. 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 serialised definition of the report you want to retrieve.

<reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201509"> <selector> <fields>CampaignId</fields> <fields>Id</fields> <fields>Impressions</fields> <fields>Clicks</fields> <fields>Cost</fields> <