Skip to main content

Google Ads

This connector captures data from resources in one or more Google Ads accounts into Flow collections via the Google Ads API.

ghcr.io/estuary/source-google-ads:dev provides the latest connector image. You can also follow the link in your browser to see past image versions.

This connector is based on an open-source connector from a third party, with modifications for performance in the Flow system. You can find their documentation here, but keep in mind that the two versions may be significantly different.

Supported data resources

The following data resources are supported. Resources ending in _report represent legacy resources from the Google Adwords API.

By default, each resource is mapped to a Flow collection through a separate binding.

You may also generate custom resources using GAQL queries.

Prerequisites

There are two ways to authenticate with Google when capturing data into Flow: using OAuth2, and manually, using tokens and secret credentials. Their prerequisites differ.

OAuth is recommended for simplicity in the Flow web app; the manual method is the only supported method using the command line.

Customer Id & Login Customer Id

The Login Customer Id setting refers to your MCC Google Ads account Id. One can easily find this number by accessing their Google Ads Dashboard and look to the far right corner of their screen.

Example:

Screenshot from 2024-02-19 05-10-29

In the above example, my login_customer_id would be 1234567890.

The Customer Id setting refers to your Client Accounts under a MCC account. One can easily find this number by accessing their Google Ads Dashboard and look to the far left corner of their screen, after selecting a client account.

Example:

Screenshot from 2024-02-19 05-10-16

In the above example, my customer_id would be 9876543210.

Multiple Customer Ids

This Source allows for multiple Customer Ids to be selected. To allow this, simply add your customer_id followed by a comma.

Example:

Customer1 = 1234567890 Customer2 = 9876543210

customer_id = 1234567890,9876543210

Using OAuth2 to authenticate with Google in the Flow web app

Configuring the connector specification manually

caution

Developer token applications are independently reviewed by Google and may take one or more days to be approved. Be sure to carefully review Google's requirements before submitting an application.

Configuration

You configure connectors either in the Flow web app, or by directly editing the Flow specification file. See connectors to learn more about using connectors. The values and specification sample below provide configuration details specific to the Google Ads source connector.

Properties

Endpoint

The properties in the table below reflect the manual authentication method. If you're working in the Flow web app, you'll use OAuth2, so many of these properties aren't required.

PropertyTitleDescriptionTypeRequired/Default
/conversion_window_daysConversion Window (Optional)A conversion window is the period of time after an ad interaction (such as an ad click or video view) during which a conversion, such as a purchase, is recorded in Google Ads. For more information, see Google's docs.integer14
/credentialsGoogle CredentialsobjectRequired
/credentials/client_idClient IDThe Client ID of your Google Ads developer application.stringRequired
/credentials/client_secretClient SecretThe Client Secret of your Google Ads developer application.stringRequired
/credentials/developer_tokenDeveloper TokenDeveloper token granted by Google to use their APIs.stringRequired
/credentials/refresh_tokenRefresh TokenThe token for obtaining a new access token.stringRequired
/custom_queriesCustom GAQL Queries (Optional)array
/custom_queries/-/queryCustom QueryA custom defined GAQL query for building the report. Should not contain segments.date expression. See Google's query builder for more information.string
/custom_queries/-/table_nameDestination Table NameThe table name in your destination database for chosen query.string
/customer_idCustomer ID(s)Comma separated list of (client) customer IDs. Each customer ID must be specified as a 10-digit number without dashes. More instruction on how to find this value in our docs. Metrics streams like AdGroupAdReport cannot be requested for a manager account.stringRequired
/end_dateEnd Date (Optional)UTC date in the format 2017-01-25. Any data after this date will not be replicated.string
/login_customer_idLogin Customer ID for Managed Accounts (Optional)If your access to the customer account is through a manager account, this field is required and must be set to the customer ID of the manager account (10-digit number without dashes).string
/start_dateStart DateUTC date in the format 2017-01-25. Any data before this date will not be replicated.stringRequired

Bindings

PropertyTitleDescriptionTypeRequired/Default
/streamStreamGoogle Ad resource from which a collection is captured.stringRequired
/syncModeSync ModeConnection method.stringRequired

Sample

This sample specification reflects the manual authentication method.

captures:
${PREFIX}/${CAPTURE_NAME}:
endpoint:
connector:
image: ghcr.io/estuary/source-google-ads:dev
config:
conversion_window_days: 7
credentials:
client_id: {secret_client_ID}
client_secret: {secret_secret}
developer_token: {access_token}
refresh_token: {refresh_token}
customer_id: 0123456789, 1234567890
login_customer_id: 0987654321
end_date: 2022-01-01
start_date: 2020-01-01
custom_queries:
- query:
SELECT
campaign.id,
campaign.name,
campaign.status
FROM campaign
ORDER BY campaign.id
table_name: campaigns_custom
bindings:
- resource:
stream: campaign
syncMode: incremental
target: ${PREFIX}/campaign
{...}

Custom queries

You can create custom resources using Google Analytics Query Language (GAQL) queries. Each generated resource will be mapped to a Flow collection. For help generating a valid query, see Google's query builder documentation.

If a query fails to validate against a given Google Ads account, it will be skipped.

Stream Limitations

ClickView

Due to Google Ads API limitations, ClickView stream queries are executed with a time range limited to one day. Also, data can only be requested for periods 90 days before the time of the request.

In pratical terms, this means that you can only search ClickView data limited to 3 months ago, anything before this is not returned.

For more information, check Google's Ads API documentation