This page provides you with instructions on how to extract data from AdWords and load it into Google BigQuery. (If this manual process sounds onerous, check out Stitch, which can do all the heavy lifting for you in just a few clicks.)
What is Google AdWords?
Google AdWords is an extremely popular paid marketing tool. Since Google has almost 70% market share when it comes to searching the internet, this comes as no surprise. It's an easy tool to use. You just set your budget, select your keywords and publish the ads. This will create text ads that appear in the results of Google searches relevant to your keywords. The data AdWords collects about your campaigns is handy when it's time to measure their effectiveness and decide how to optimize them.
What is Google BigQuery?
Google BigQuery is a data warehouse that delivers super-fast results from SQL queries, which it accomplishes using a powerful engine dubbed Dremel. With BigQuery, there's no spinning up (and down) clusters of machines as you work with your data. With all of that said, it's clear why some claim that BigQuery prioritizes querying over administration. It's super fast, and that's the reason why most folks use it.
Getting data out of AdWords
The first step of getting your AdWords data into your data warehouse is actually pulling that data off of Google’s servers. You can do this using the AdWords API’s Reporting features, which are available to all AdWords customers. This is just a subset of that API’s functionality, which also includes the ability to manage ads.
You can also link your Google Analytics and Google AdWords accounts to allow the data to cross-pollinate. This can lead to much richer reporting due to the breadth of knowledge that exists in Google Analytics about the people who may have viewed or clicked your ads.
The data you extract from AdWords API reports can be quite granular, allowing you to see things like impressions, clickthrough rates, and CPC broken out by time period.
Loading data into Google BigQuery
Google Cloud Platform offers a helpful guide for loading data into BigQuery. You can use the
bq command-line tool to upload the files to your awaiting datasets, adding the correct schema and data type information along the way. The
bq load command is your friend here. You can find the syntax in the bq command-line tool quickstart guide. Iterate through this process as many times as it takes to load all of your tables into BigQuery.
Keeping AdWords data up to date
So, now what? You’ve built a script that pulls data from AdWords and loads it into Redshift, but what happens tomorrow when you have thousands of new impressions?
The key is to build your script in such a way that it can also identify incremental updates to your data. If you can identify some fields that auto increment, you could use them to give your script the ability to recognize new data. Lastly, set your script up as a cron job or continuous loop to keep pulling down new data as it appears.
Other data warehouse options
BigQuery is really great, but sometimes you need to optimize for different things when you're choosing a data warehouse. Some folks choose to go with Postgres or Redshift, which are two RDBMSes that use similar SQL syntax. If you're interested in seeing the relevant steps for loading this data into Postgres or Redshift, check out To Redshift and To Postgres.
Easier and faster alternatives
If all this sounds a bit overwhelming, don’t be alarmed. If you have all the skills necessary to go through this process, chances are building and maintaining a script like this isn’t a very high-leverage use of your time.
Thankfully, products like Stitch were built to solve this problem automatically. With just a few clicks, Stitch starts extracting your AdWords data via the API, structuring it in a way that is optimized for analysis, and inserting that data into your Google BigQuery data warehouse.