Skip to content

Latest commit

 

History

History
184 lines (142 loc) · 19.5 KB

google-ads.md

File metadata and controls

184 lines (142 loc) · 19.5 KB

Google Ads

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

Prerequisites

Google Ads registered account with

  • Customer ID
  • Login Customer ID (you can find more information about this field in Google Ads docs)
  • Custom GAQL Queries (if needed)

Also:

  • Start Date
  • End Date
  • Conversion Window

For Airbyte OSS: Google Ads Account with an approved Developer Token. (note: In order to get API access to Google Ads, you must have a "manager" account; standard accounts cannot generate a Developer Token. This manager account must be created separately from your standard account. You can find more information about this distinction in the Google Ads docs.) You'll also need to find these values. See the setup guide for instructions.

  • Client ID
  • Client Secret
  • Refresh Token

Setup guide

Step 1: Set up Google Ads

This guide will provide information as if starting from scratch. Please skip over any steps you have already completed.

  1. Create a Google Ads Account. Here are Google's instructions on how to create one.
  2. Create a Google Ads MANAGER Account. Here are Google's instructions on how to create one.
  3. You should now have two Google Ads accounts: a normal account and a manager account. Link the Manager account to the normal account following Google's documentation.
  4. Select your customer_id. The customer_id refers to the id of each of your Google Ads accounts. This is the 10 digit number in the top corner of the page when you are in Google Ads UI. The source will only pull data from the accounts for which you provide an id. If you are having trouble finding it, check out Google's instructions.

Airbyte Open Source additional setup steps

  1. Apply for a developer token (make sure you follow our instructions on your Manager account. This token allows you to access your data from the Google Ads API. Here are Google's instructions. The docs are a little unclear on this point, but 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. It usually takes Google 24 hours to respond to these applications. This developer token is the value you will use in the developer_token field.
  2. Fetch your client_id, client_secret, and refresh_token. Google provides instructions on how to do this.

How to apply for the developer token

Google is very picky about which software and which use case can get access to a developer token. The Airbyte team has worked with the Google Ads team to whitelist Airbyte and make sure you can get one (see issue 1981 for more information). When you apply for a token, you need to mention:

  • Why you need the token (eg: 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)

Step 2: Set up the Google Ads connector in Airbyte

For Airbyte Cloud:

  1. Log into your Airbyte Cloud account.
  2. In the left navigation bar, click Sources. In the top-right corner, click +new source.
  3. On the Set up the source page, enter the name for the Google Ads connector and select Google Ads from the Source type dropdown.
  4. Click Authenticate your Google Ads account to sign in with Google and authorize your account.
  5. Get the customer ID for your account. Learn how to do that here
  6. If your access to the account is through a manager account, get the customer ID of the manager account.
  7. Fill out a start date, and optionally, a conversion window, and custom GAQL.
  8. You're done.

For Airbyte OSS:

  1. Create a new Google Ads source with a suitable name.
  2. Get the customer ID for your account. Learn how to do that here
  3. If your access to the account is through a manager account, get the customer ID of the manager account.
  4. Fill out a start date, and optionally, end date and a conversion window, and custom GAQL.
  5. Fill out the Client ID, Client Secret, Access Token(if any), Refresh Token and the Developer Token from Step 1)
  6. You're done

Supported sync modes

The Google Ads source connector supports the following sync modes:

  • Full Refresh | Overwrite
  • Full Refresh | Append
  • Incremental Sync | Append
  • Incremental Sync | Deduped History

Supported Streams

This source is capable of syncing the tables described below and can sync custom queries using GAGL.

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

Custom Query: understanding Google Ads Query Language

The Google Ads Query Language can query the Google Ads API. Check out Google Ads Query Language and the query builder. You can add these as custom queries when configuring the Google Ads source.

:::note
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.
:::

:::warning
Please take into account Google's note on [Selectability between segments and metrics](https://developers.google.com/google-ads/api/docs/reporting/segmentation#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 not obvious and undesired behaviour and can lead to missing data records. If you do need this field in the stream, please choose adding a new stream instead of editing existing ones.
:::

Performance considerations

This source is constrained by whatever API limits are set for the Google Ads that is used. You can read more about those limits in the Google Developer docs.

Changelog

Version Date Pull Request Subject
0.1.44 2022-07-27 15084 Fix data type ad_group_criterion.topic.path in display_topics_performance_report and shifted campaigns to non-managers streams
0.1.43 2022-07-12 14614 Update API version to v11, update google-ads to 17.0.0
0.1.42 2022-06-08 13624 Update google-ads to 15.1.1, pin protobuf==3.20.0 to work on MacOS M1 machines (AMD)
0.1.41 2022-06-08 13618 Add missing dependency
0.1.40 2022-06-02 13423 Fix the missing data issue
0.1.39 2022-05-18 12914 Fix GAQL query validation and log auth errors instead of failing the sync
0.1.38 2022-05-12 12807 Documentation updates
0.1.37 2022-05-06 12651 Improve integration and unit tests
0.1.36 2022-04-19 12158 Fix *_labels streams data type
0.1.35 2022-04-18 9310 Add new fields to reports
0.1.34 2022-03-29 11602 Add budget amount to campaigns stream.
0.1.33 2022-03-29 11513 When end_date is configured in the future, use today's date instead.
0.1.32 2022-03-24 11371 Improve how connection check returns error messages
0.1.31 2022-03-23 11301 Update docs and spec to clarify usage
0.1.30 2022-03-23 11221 Add *_labels streams to fetch the label text rather than their IDs
0.1.29 2022-03-22 10919 Fix user location report schema and add to acceptance tests
0.1.28 2022-02-25 10372 Add network fields to click view stream
0.1.27 2022-02-16 10315 Make ad_group_ads and other streams support incremental sync.
0.1.26 2022-02-11 10150 Add support for multiple customer IDs.
0.1.25 2022-02-04 9812 Handle EXPIRED_PAGE_TOKEN exception and retry with updated state.
0.1.24 2022-02-04 9996 Use Google Ads API version V9.
0.1.23 2022-01-25 8669 Add end date parameter in spec.
0.1.22 2022-01-24 9608 Reduce stream slice date range.
0.1.21 2021-12-28 9149 Update title and description
0.1.20 2021-12-22 9071 Fix: Keyword schema enum
0.1.19 2021-12-14 8431 Add new streams: Geographic and Keyword
0.1.18 2021-12-09 8225 Include time_zone to sync. Remove streams for manager account.
0.1.16 2021-11-22 8178 clarify setup fields
0.1.15 2021-10-07 6684 Add new stream click_view
0.1.14 2021-10-01 6565 Fix OAuth Spec File
0.1.13 2021-09-27 6458 Update OAuth Spec File
0.1.11 2021-09-22 6373 Fix inconsistent segments.date field type across all streams
0.1.10 2021-09-13 6022 Annotate Oauth2 flow initialization parameters in connector spec
0.1.9 2021-09-07 5302 Add custom query stream support
0.1.8 2021-08-03 5509 allow additionalProperties in spec.json
0.1.7 2021-08-03 5422 Correct query to not skip dates
0.1.6 2021-08-03 5423 Added new stream UserLocationReport
0.1.5 2021-08-03 5159 Add field login_customer_id to spec
0.1.4 2021-07-28 4962 Support new Report streams
0.1.3 2021-07-23 4788 Support main streams, fix bug with exception DATE_RANGE_TOO_NARROW for incremental streams
0.1.2 2021-07-06 4539 Add AIRBYTE_ENTRYPOINT for Kubernetes support
0.1.1 2021-06-23 4288 Bugfix: Correctly declare required parameters