AdWords to Redshift

This page provides you with instructions on how to extract data from AdWords and load it into Redshift. (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 a popular paid marketing tool. With AdWords, you set a budget, select keywords, and publish ads that appear on Google search results pages relevant to your keywords. AdWords collects data about campaigns that businesses can use to measure their effectiveness.

Getting data out of AdWords

Google provides a SOAP API for AdWords. The first step of getting your AdWords data into your data warehouse is pulling the data off of Google's servers by using the AdWords API's Reporting features. This is a subset of the 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 provide richer reporting due to the breadth of knowledge that exists in Google Analytics about the people who may have viewed or clicked your ads.

You can extract granular data from AdWords API reports, allowing you to see things like impressions, clickthrough rates, and CPC broken out by time period.

Loading data into Redshift

When you've identified all the columns you want to insert, use the Reshift CREATE TABLE statement to make a table in your data warehouse to receive the data.

Now you can replicate your data. It may seem as if the easiest way to do that (especially if there isn't much of it) is to build INSERT statements and add data to your table row by row. If you have any experience with SQL, this probably will be your first inclination. But beware! Redshift isn't optimized for inserting data one row at a time. If you have a high volume of data to be inserted, you should instead load the data into Amazon S3 and then use the Redshift COPY command to import it into Redshift.

Keeping AdWords data up to date

So, now what? You've built a script that pulls data from AdWords and loads it into your data warehouse, 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. You can then set your script up as a cron job or continuous loop to keep pulling down new data as it appears.

Other data warehouse options

Redshift is great, but sometimes you need to optimize for different things when you're choosing a data warehouse. Some folks choose to go with Google BigQuery, PostgreSQL, or Snowflake, which are RDBMSes that use similar SQL syntax, or Panoply, which works with Redshift instances. If you're interested in seeing the relevant steps for loading data into one of these platforms, check out To BigQuery, To Postgres, To Snowflake, and To Panoply.

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 Redshift data warehouse.