Google AdWords API deprecation: Migrating data sources and Klips to use the new Google Ads API

The Google AdWords API is being deprecated and will be replaced by the Google Ads API. As a result, it will no longer be supported as of April 27, 2022.

To ensure your existing Google AdWords data sources continue collecting data, you’ll need to migrate them to use the new API. This article walks you through the migration process.

Note: In 2018, when Google changed the name of their Google AdWords app, we responded accordingly by renaming our connector to Google Ads. However, our connector continued to use the Google AdWords API. We are now returning to the “Google AdWords” naming for our older existing connector. Our new connector will use the Google Ads API and will be called “Google Ads”.

This article includes:

Migrating your data sources

It’s a good idea to create a backup copy of each data source in case you want to restore it or refer back to it. As such, we recommend duplicating each Google AdWords data source before migrating.

To migrate Google AdWords data sources:

  1. In the left navigation sidebar, click Data Sources.

If you don’t see the above option, go to the bottom of the left navigation sidebar and click your Account Name > Data Sources instead.

  1. Select a Google AdWords data source you want to migrate.

The data source details page opens.

  1. At the top of the page, click Duplicate.

This creates a backup copy to refer to later and is particularly helpful when remapping your Klips and formulas.

  1. After naming and saving the backup data source, return to the original data source.

We recommend migrating the original data source instead of the duplicated copy, as this will make it easier for you later when you’re updating your Klips and formulas.

  1. Scroll down to the Migrate to New API section.
  2. Click Start migration.

  1. The Edit Data Source page opens and Google Ads displays at the top.
  2. Copy the query in the Body field, excluding the __rdquery= portion (at the beginning of the query) and the &fmt=CSV&mode=Standard portion (at the end of the query).

Note: Don’t close this tab. You’ll return here in step 14.

  1. In a new tab, go to the Google Ads API Query Migration Tool.
  2. Paste the query you copied from the Body field in step 8 into the AWQL Query field. (See screenshot below.)
  3. Enter a Customer ID if applicable. (See screenshot below.)

If needed, you can find the customer ID in the URL of the data source. Remember to add hyphens to align with the required format.

  1. Click Convert. (See screenshot below.)

Note: The new Google Ads query displays at the bottom of the window in green.

  1. Format the new query as JSON. In our example, it looks like this: {"query": "SELECT customer.descriptive_name,metrics.all_conversions FROM customer WHERE segments.date DURING LAST_7_DAYS"} and copy it.
  2. Go back to your data source in Klipfolio and paste the new query over the old query in the Body field. (See below.)

  1. Click Get data to test the migrated query and confirm there are no errors.
  2. Update related Klips and formulas to use the new data source and the JSON response (instead of the previous CSV response). See the following section Migrating your Klips and formulas for more details.

A few migration tips (with examples)

Here are a few tips to keep in mind when migrating:

  • Examine the query that’s returned by the Google Ads API Query Migration Tool. The only double quotes in the body should be the ones surrounding “query” and the full request (the portion beginning with SELECT). Any other double quotes need to be changed to single quotes.
  • Date parameters must be on separate lines in the query, apart from the rest of the body. (This also applies to dynamic variables in the {props.variable} format.)

For example:

{“query”:“SELECT customer.descriptive_name, campaign.name, metrics.clicks, segments.date FROM keyword_view WHERE segments.date BETWEEN

‘{date.add(-7).format()}’

AND

'{date.today}'

"}

  • If your query uses dynamic dates, the references to those dynamic dates will not be converted by the Google Ads API Query Migration Tool. To convert the query, edit the initial query in the migration tool by substituting the dynamic dates with hard coded dates using the format yyyyMMdd. After it’s converted, substitute the converted date values with your dynamic dates, wrapped in single quotes.

Here’s an example of converting a query that uses dynamic dates:

  1. Replace dynamic dates with dates that use the format yyyyMMdd, for example, replace {date.add(-30).format(‘yyyyMMdd’)} with 20220101.
  2. Convert the query using the Google Ads API Query Migration Tool. (See step 12 in the above procedure.)
  3. Copy and paste the converted query into the body field for the data source in Klipfolio.
  4. Edit the pasted query by:
  • Changing it into a JSON format. (See step 13 in the above procedure.)
  • Setting the WHERE clause as multi-line. (Date parameters must be on separate lines in the query, apart from the rest of the body.)
  • Changing the dates back to be dynamic. (See final query below.)

Example - Original query with dynamic dates:

SELECT
AverageCpc,Amount,Period,Ctr,CampaignId,Clicks,ConversionRate,Cost,CostPerConversion,Date,Impressions,AdNetworkType1,ConversionValue
FROM CAMPAIGN_PERFORMANCE_REPORT
DURING
{date.add(-30).format('yyyyMMdd')},{date.today.format('yyyyMMdd')
}

Example - Converted query:

SELECT
AverageCpc,Amount,Period,Ctr,CampaignId,Clicks,ConversionRate,Cost,CostPerConversion,Date,Impressions,AdNetworkType1,ConversionValue
FROM CAMPAIGN_PERFORMANCE_REPORT
DURING 20220131,20220315

Example - Final query (that includes the dynamic dates from the original query):

{"query":"SELECT metrics.average_cpc, campaign_budget.amount_micros, campaign_budget.period, metrics.ctr, campaign.id, metrics.clicks, metrics.conversions_from_interactions_rate, metrics.cost_micros, metrics.cost_per_conversion, segments.date, metrics.impressions, metrics.conversions_value FROM campaign WHERE segments.date
BETWEEN
{date.add(-30).format('yyyyMMdd')}
AND
{date.today.format('yyyyMMdd')} "}

Migrating your Klips and formulas

After migrating your data sources to the new Google Ads API, you’ll need to remap your existing Klips and formulas to point to your new data sources, which are now using a JSON format instead of a CSV format.

We recommend using the copy you made of your old data source as a reference. This will help you identify which data in your Klips corresponds to which columns of data in your original data source. You’ll then be able to browse through your JSON data to find the matching entry for each column of data.

Migrating from CSV to JSON format - Example: Keyword Performance Report

The Google Ads Keyword Performance Report returns metrics on each keyword you’re tracking in Google Ads. It also includes information on the ad group the keyword is applied to and the month in which the ads are active.

In the original CSV output, each of these fields are listed as adjacent columns. (See below for an example of CSV output.)

JSON output is structured differently, with column values separated into nodes such as ‘campaign’, ‘adGroup’ , ‘metrics’ , adGroupCriterion’ , ‘keywordView’, and ‘segments’. (See below for an example of JSON output.)

To see which nodes contain your data as it displays in your CSV data file, refer to the fieldMask data point. You’ll find it at the bottom of your JSON output. (See below.)

The fieldMask data element contains a comma-separated list of data headers using the format nodename.header. This list will match the order of headers in your CSV data.

Go through the comma-separated list in the fieldMask data element and map each column from your CSV data to your new JSON data source. For example:

  • The first column in the CSV report is ‘adGroup’. To retrieve that column of data, in the JSON data source, navigate to the ‘adGroup’ node and select the ‘name’ values.
  • The second column in the CSV report is AVG CPC. To retrieve that column of data, in the JSON data source, navigate to the ‘metrics’ node and select the ‘averageCpc’ value.

Repeat this process to successfully map each column from your CSV data to your new JSON data source.

Have more questions? Submit a request