Skip to main content

Google Ads

This page contains the setup guide and reference information for the Google Ads source connector.

Prerequisites

  • A Google Ads Account linked to a Google Ads Manager account
  • (For Airbyte Open Source):
    • A Developer Token
    • OAuth credentials to authenticate your Google account

Setup guide

Step 1: (For Airbyte Open Source) Apply for a developer token

To set up the Google Ads source connector with Airbyte Open Source, you will need to obtain a developer token. This token allows you to access your data from the Google Ads API. Please note that Google is selective about which software and use cases are issued this token. The Airbyte team has worked with the Google Ads team to allowlist Airbyte and ensure you can get a developer token (see issue 1981 for more information on this topic).

  1. To proceed with obtaining a developer token, you will first need to create a Google Ads Manager account. Standard Google Ads accounts cannot generate a developer token.

  2. To apply for the developer token, please follow Google's instructions.

  3. When you apply for the token, make sure to include the following:

    • Why you need the token (example: Want to run some internal analytics)
    • That you will be using the Airbyte Open Source project
    • That you have full access to the code base (because we're open source)
    • That you have full access to the server running the code (because you're self-hosting Airbyte)
note

You will not be able to access your data via the Google Ads API until this token is approved. You cannot use a test developer token; it has to be at least a basic developer token. The approval process typically takes around 24 hours.

Step 2: (For Airbyte Open Source) Obtain your OAuth credentials

If you are using Airbyte Open Source, you will need to obtain the following OAuth credentials to authenticate your Google Ads account:

  • Client ID
  • Client Secret
  • Refresh Token

Please refer to Google's documentation for detailed instructions on how to obtain these credentials.

Step 3: Set up the Google Ads connector in Airbyte

For Airbyte Cloud:

To set up Google Ads as a source in Airbyte Cloud:

  1. Log in to your Airbyte Cloud account.
  2. In the left navigation bar, click Sources. In the top-right corner, click + New source.
  3. Find and select Google Ads from the list of available sources.
  4. Enter a Source name of your choosing.
  5. Click Sign in with Google to authenticate your Google Ads account. In the pop-up, select the appropriate Google account and click Continue to proceed.
  6. Enter a comma-separated list of the Customer ID(s) for your account. These IDs are 10-digit numbers that uniquely identify your account. To find your Customer ID, please follow Google's instructions.
  7. Enter a Start Date using the provided datepicker, or by programmatically entering the date in YYYY-MM-DD format. The data added on and after this date will be replicated.
  8. (Optional) You can use the Custom GAQL Queries field to enter a custom query using Google Ads Query Language. Click Add and enter your query, as well as the desired name of the table for this data in the destination. Multiple queries can be provided. For more information on formulating these queries, refer to our guide below.
  9. (Required for Manager accounts) If accessing your account through a Google Ads Manager account, you must enter the Customer ID of the Manager account.
  10. (Optional) Enter a Conversion Window. This is the number of days after an ad interaction during which a conversion is recorded in Google Ads. For more information on this topic, refer to the Google Ads Help Center. This field defaults to 14 days.
  11. (Optional) Enter an End Date in YYYY-MM-DD format. Any data added after this date will not be replicated. Leaving this field blank will replicate all data from the start date onward.
  12. Click Set up source and wait for the tests to complete.

For Airbyte Open Source:

To set up Google Ads as a source in Airbyte Open Source:

  1. Log in to your Airbyte Open Source account.
  2. In the left navigation bar, click Sources. In the top-right corner, click + New source.
  3. Find and select Google Ads from the list of available sources.
  4. Enter a Source name of your choosing.
  5. Enter the Developer Token you obtained from Google.
  6. To authenticate your Google account, enter your Google application's Client ID, Client Secret, Refresh Token, and optionally, the Access Token.
  7. Enter a comma-separated list of the Customer ID(s) for your account. These IDs are 10-digit numbers that uniquely identify your account. To find your Customer ID, please follow Google's instructions.
  8. Enter a Start Date using the provided datepicker, or by programmatically entering the date in YYYY-MM-DD format. The data added on and after this date will be replicated.
  9. (Optional) You can use the Custom GAQL Queries field to enter a custom query using Google Ads Query Language. Click Add and enter your query, as well as the desired name of the table for this data in the destination. Multiple queries can be provided. For more information on formulating these queries, refer to our guide below.
  10. (Required for Manager accounts) If accessing your account through a Google Ads Manager account, you must enter the Customer ID of the Manager account.
  11. (Optional) Enter a Conversion Window. This is the number of days after an ad interaction during which a conversion is recorded in Google Ads. For more information on this topic, see the section on Conversion Windows below, or refer to the Google Ads Help Center. This field defaults to 14 days.
  12. (Optional) Enter an End Date in YYYY-MM-DD format. Any data added after this date will not be replicated. Leaving this field blank will replicate all data from the start date onward.
  13. Click Set up source and wait for the tests to complete.

Supported sync modes

The Google Ads source connector supports the following sync modes:

Incremental events streams

List of stream:

These streams support incremental updates, including deletions, leveraging the Change Status stream. However, they only capture updates from the most recent three months.

The initial sync operates as a full refresh. Subsequent syncs begin by reading updates from the Change Status stream, followed by syncing records based on their IDs.

danger

It's important to note that the Google Ads API resource ChangeStatus has a limit of 10,000 records per request. That's why you cannot sync stream with more than 10,000 updates in a single microsecond. In such cases, it's recommended to use a full refresh sync to ensure all updates are captured.

Supported Streams

The Google Ads source connector can sync the following tables. It can also sync custom queries using GAQL.

Main Tables

Note that ad_groups, ad_group_ads, and campaigns contain a labels field, which should be joined against their respective *_labels streams if you want to view the actual labels. For example, the ad_groups stream contains an ad_group.labels field, which you would join against the ad_group_labels stream's label.resource_name field.

Report Tables

note

Due to Google Ads API constraints, the click_view stream retrieves data one day at a time and can only retrieve data newer than 90 days ago. Also, metrics cannot be requested for a Google Ads Manager account. Report streams are only available when pulling data from a non-manager account.

danger

Google Ads doesn't support PERFORMACE_MAX campaigns on ad_group or ad stream level, only on campaign level. If you have this type of campaign Google will remove them from the results for the ads reports. More info and Google Discussions.

For incremental streams, data is synced up to the previous day using your Google Ads account time zone since Google Ads can filter data only by date without time. Also, some reports cannot load data real-time due to Google Ads limitations.

Custom Query: Understanding Google Ads Query Language

Additional streams for Google Ads can be dynamically created using custom queries.

The Google Ads Query Language queries the Google Ads API. Review the Google Ads Query Language and the query builder to validate your query. You can then add these as custom queries when configuring the Google Ads source.

Example GAQL Custom Query:

SELECT
campaign.name,
metrics.conversions,
metrics.conversions_by_conversion_date
FROM ad_group

Note the segments.date is automatically added to the output, and does not need to be specified in the custom query. All custom reports will by synced by day.

Each custom query in the input configuration must work for all the customer account IDs. Otherwise, the customer ID will be skipped for every query that fails the validation test. For example, if your query contains metrics fields in the select clause, it will not be executed against manager accounts.

Follow Google's guidance on Selectability between segments and metrics when editing custom queries or default stream schemas (which will also be turned into GAQL queries by the connector). Fields like segments.keyword.info.text, segments.keyword.info.match_type, segments.keyword.ad_group_criterion in the SELECT clause tell the query to only get the rows of data that have keywords and remove any row that is not associated with a keyword. This is often unobvious and undesired behavior and can lead to missing data records. If you need this field in the stream, add a new stream instead of editing the existing ones.

info

For an existing Google Ads source, when you are updating or removing Custom GAQL Queries, you should also subsequently refresh your source schema to pull in any changes.

Note on Conversion Windows

In digital advertising, a 'conversion' typically refers to a user undertaking a desired action after viewing or interacting with an ad. This could be anything from clicking through to the advertiser's website, signing up for a newsletter, making a purchase, and so on. The conversion window is the period of time after a user sees or clicks on an ad during which their actions can still be credited to that ad.

For example, imagine an online shoe store runs an ad and sets a conversion window of 30 days. If you click on that ad today, any purchases you make on the shoe store's site within the next 30 days will be considered conversions resulting from that ad. The length of the conversion window can vary depending on the goals of the advertiser and the nature of the product or service. Some businesses might set a shorter conversion window if they're promoting a limited-time offer, while others might set a longer window if they're advertising a product that consumers typically take a while to think about before buying.

In essence, the conversion window is a tool for measuring the effectiveness of an advertising campaign. By tracking the actions users take after viewing or interacting with an ad, businesses can gain insight into how well their ads are working and adjust their strategies accordingly.

In the case of configuring the Google Ads source connector, each time a sync is run the connector will retrieve all conversions that were active within the specified conversion window. For example, if you set a conversion window of 30 days, each time a sync is run, the connector will pull all conversions that were active within the past 30 days. Due to this mechanism, it may seem like the same campaigns, ad groups, or ads have different conversion numbers. However, in reality, each data record accurately reflects the number of conversions for that particular resource at the time of extracting the data from the Google Ads API.

Performance considerations

This source is constrained by the Google Ads API limits

Due to a limitation in the Google Ads API which does not allow getting performance data at a granularity level smaller than a day, the Google Ads connector usually pulls data up until the previous day. For example, if the sync runs on Wednesday at 5 PM, then data up until Tuesday midnight is pulled. Data for Wednesday is exported only if a sync runs after Wednesday (for example, 12:01 AM on Thursday) and so on. This avoids syncing partial performance data, only to have to resync it again once the full day's data has been recorded by Google. For example, without this functionality, a sync which runs on Wednesday at 5 PM would get ads performance data for Wednesday between 12:01 AM - 5 PM on Wednesday, then it would need to run again at the end of the day to get all of Wednesday's data.

Changelog

VersionDatePull RequestSubject
0.9.02023-09-1428970Add incremental deletes for Campaign and Ad Group Criterion streams
0.8.12023-09-1330376Revert pagination changes from 0.8.0
0.8.02023-09-0130071Delete start_date from required parameters and fix pagination
0.7.42023-07-2828832Update field descriptions
0.7.32023-07-2428510Set dates with client's timezone
0.7.22023-07-2028535UI improvement: Make the query field in custom reports a multi-line string field
0.7.12023-07-17283650.3.1 and 0.3.2 follow up: make today the end date, not yesterday
0.7.02023-07-1228246Add new streams: labels, criterions, biddig strategies
0.6.12023-07-1228230Reduce amount of logs produced by the connector while working with big amount of data
0.6.02023-07-1028078Add new stream Campaign Budget
0.5.02023-07-0728042Add metrics & segment to Campaigns stream
0.4.32023-07-0527959Add audience and user_interest streams
0.3.32023-07-0327913Improve Google Ads exception handling (wrong customer ID)
0.3.22023-06-2927835Fix bug introduced in 0.3.1: update query template
0.3.12023-06-2627711Refactor date slicing; make start date inclusive
0.3.02023-06-2627738License Update: Elv2
0.2.242023-06-0627608Improve Google Ads exception handling
0.2.232023-06-0626905Replace deprecated authSpecification in the connector specification with advancedAuth
0.2.222023-06-0226948Refactor error messages; add pattern_descriptor for fields in spec
0.2.212023-05-3025314Add full refresh custom table asset_group_listing_group_filter
0.2.202023-05-3025624Add asset Resource to full refresh custom tables (GAQL Queries)
0.2.192023-05-1526209Handle Token Refresh errors as config_error
0.2.182023-05-1525947Improve GAQL parser error message if multiple resources provided
0.2.172023-05-1125987Categorized Config Errors Accurately
0.2.162023-05-1025965Fix Airbyte date-time data-types
0.2.142023-03-2124945For custom google query fixed schema type for "data_type: ENUM" and "is_repeated: true" to array of strings
0.2.132023-03-2124338Migrate to v13
0.2.122023-03-1722985Specified date formatting in specification
0.2.112023-03-1323999Fix incremental sync for Campaigns stream
0.2.102023-02-1122703Add support for custom full_refresh streams
0.2.92023-01-2321705Fix multibyte issue; Bump google-ads package to 19.0.0
0.2.82023-01-1821517Write fewer logs
0.2.72023-01-1020755Add more logs to debug stuck syncs
0.2.62022-12-2220855Retry 429 and 5xx errors
0.2.52022-11-2219700Fix schema for campaigns stream
0.2.42022-11-0919208Add TypeTransofrmer to Campaings stream to force proper type casting
0.2.32022-10-1718069Add segments.hour, metrics.ctr, metrics.conversions and metrics.conversions_values fields to campaigns report stream
0.2.22022-10-2117412Release with CDK >= 0.2.2
0.2.12022-09-2917412Always use latest CDK version
0.2.02022-08-2315858Mark the query and table_name fields in custom_queries as required
0.1.442022-07-2715084Fix data type ad_group_criterion.topic.path in display_topics_performance_report and shifted campaigns to non-managers streams
0.1.432022-07-1214614Update API version to v11, update google-ads to 17.0.0
0.1.422022-06-0813624Update google-ads to 15.1.1, pin protobuf==3.20.0 to work on MacOS M1 machines (AMD)
0.1.412022-06-0813618Add missing dependency
0.1.402022-06-0213423Fix the missing data issue
0.1.392022-05-1812914Fix GAQL query validation and log auth errors instead of failing the sync
0.1.382022-05-1212807Documentation updates
0.1.372022-05-0612651Improve integration and unit tests
0.1.362022-04-1912158Fix *_labels streams data type
0.1.352022-04-189310Add new fields to reports
0.1.342022-03-2911602Add budget amount to campaigns stream.
0.1.332022-03-2911513When end_date is configured in the future, use today's date instead.
0.1.322022-03-2411371Improve how connection check returns error messages
0.1.312022-03-2311301Update docs and spec to clarify usage
0.1.302022-03-2311221Add *_labels streams to fetch the label text rather than their IDs
0.1.292022-03-2210919Fix user location report schema and add to acceptance tests
0.1.282022-02-2510372Add network fields to click view stream
0.1.272022-02-1610315Make ad_group_ads and other streams support incremental sync.
0.1.262022-02-1110150Add support for multiple customer IDs.
0.1.252022-02-049812Handle EXPIRED_PAGE_TOKEN exception and retry with updated state.
0.1.242022-02-049996Use Google Ads API version V9.
0.1.232022-01-258669Add end date parameter in spec.
0.1.222022-01-249608Reduce stream slice date range.
0.1.212021-12-289149Update title and description
0.1.202021-12-229071Fix: Keyword schema enum
0.1.192021-12-148431Add new streams: Geographic and Keyword
0.1.182021-12-098225Include time_zone to sync. Remove streams for manager account.
0.1.162021-11-228178Clarify setup fields
0.1.152021-10-076684Add new stream click_view
0.1.142021-10-016565Fix OAuth Spec File
0.1.132021-09-276458Update OAuth Spec File
0.1.112021-09-226373Fix inconsistent segments.date field type across all streams
0.1.102021-09-136022Annotate Oauth2 flow initialization parameters in connector spec
0.1.92021-09-075302Add custom query stream support
0.1.82021-08-035509Allow additionalProperties in spec.json
0.1.72021-08-035422Correct query to not skip dates
0.1.62021-08-035423Added new stream UserLocationReport
0.1.52021-08-035159Add field login_customer_id to spec
0.1.42021-07-284962Support new Report streams
0.1.32021-07-234788Support main streams, fix bug with exception DATE_RANGE_TOO_NARROW for incremental streams
0.1.22021-07-064539Add AIRBYTE_ENTRYPOINT for Kubernetes support
0.1.12021-06-234288Fix Bugfix: Correctly declare required parameters