Google Ads transfers
The BigQuery Data Transfer Service for Google Ads (formerly known as Google AdWords) lets you automatically schedule and manage recurring load jobs for Google Ads reporting data.
Supported reports
The BigQuery Data Transfer Service for Google Ads currently supports Google Ads API v13:
For information about how Google Ads reports are transformed into BigQuery Data Transfer Service tables and views, see Google Ads report transformations.
To map Google Ads reports to what you see in the Google Ads UI, see Mapping reports to the Google Ads UI.
Reporting option | Support |
---|---|
Supported API version | |
Schedule | Daily, at the time the transfer is first created (default) You can configure the time of day. |
Refresh window | Last 7 days (default) Configurable up to 30 days Snapshots of Match Tables are taken once a day and stored in the partition for the latest run date. Match Table snapshots are NOT updated for backfills or for days loaded via the refresh window. For information about which Match Tables are not updated by the refresh window, see Set up a backfill. |
Maximum backfill duration | No limit While Google Ads has no known data retention limits except Click Performance Report, the BigQuery Data Transfer Service has limits on how many days can be requested in a single backfill. For information about backfills, see Set up a backfill. |
Number of Customer IDs per manager account | 8,000 The BigQuery Data Transfer Service supports a maximum of 8000 Customer IDs for each Google Ads manager account (MCC). |
Before you begin
Before you create a Google Ads transfer, do the following:
- Verify that you have completed all actions required to enable the BigQuery Data Transfer Service.
- Create a BigQuery Data Transfer Service dataset to store the Google Ads data.
- If you intend to set up transfer run notifications for Pub/Sub, ensure that you have the
pubsub.topics.setIamPolicy
permission. Pub/Sub permissions are not required if you set up email notifications. For more information, see BigQuery Data Transfer Service run notifications.
Required permissions
Ensure that the person creating the transfer has the following required permissions:
BigQuery Data Transfer Service:
bigquery.transfers.update
permissions to create the transfer- Both
bigquery.datasets.get
andbigquery.datasets.update
permissions on the target dataset
The
bigquery.admin
predefined IAM role includesbigquery.transfers.update
,bigquery.datasets.update
andbigquery.datasets.get
permissions. For more information about IAM roles in BigQuery Data Transfer Service, see Access control reference.Google Ads: Read access to the Google Ads Customer ID or manager account (MCC) that is used in the transfer configuration.
Google Ads connector
All queries that you create after transferring the configuration between AdWords and Google Ads are supported by the Google Ads API. The Google Ads API has a modified schema compared to the previous AdWords API. You can compare the differences here.
You can create new Google Ads transfer configurations which will transfer your data using the new schema. See setting up a Google Ads data transfer. BigQuery will automatically create new Google Ads configurations for all existing AdWords configurations which will allow you to continue using the old schema.
If you manually transfer the configuration, set up new Google Ads API transfers with the same customer IDs used for Google Ads transfers. See setting up a Google Ads data transfer. Your queries and table views reflect the new schema.
After transferring the configuration, all queries
in projects that you created before the transfer are
automatically displayed with the old schema, letting you maintain your usual
workflow. With the exception of any deprecated tables or fields, any queries for projects created after transferring the configuration
use the new schema. See Google Ads transformation for more information. You also see two views. The first view is the same as the
views prior to transferring the configuration but updated for backwards
compatibility. Any data that has a run date before the date of transferring the
configuration is pulled from AdWords tables, and any data with a run date after
transferring the configuration is pulled from Google Ads tables. The
second view is prefixed with Ads_
and only pulls data from
Google Ads tables.
Backwards compatibility
The Google Ads connector helps to ensure that your workflow remains the same after transferring from Adwords to Google Ads. Due to the backwards compatibility of the two sets of reporting data, you will be able to continue working with your Adwords workflow while using new Google Ads data. Some tables have been deprecated in Google Ads and therefore will not be backwards compatible with Adwords. Backwards compatibility only applies to BigQuery views.
For example, consider a migration from Adwords to Google Ads that
occurred on 2022-05-01
. The following table shows columns from the
ads_AccountBasicStats
view.
+------------+----------------+---------------------+--------------+------------+
|customer_id | metrics_clicks | metrics_cost_micros | _LATEST_DATE | _DATA_DATE |
+------------+----------------+---------------------+--------------+------------+
|1234567890 | 1212 | 430900867 | 2023-01-31 | 2022-12-07 |
|1234567890 | 1163 | 647597711 | 2023-01-31 | 2023-01-06 |
|1234567890 | 1156 | 384169744 | 2023-01-31 | 2022-12-11 |
|1234567890 | 1150 | 372517099 | 2023-01-31 | 2022-12-08 |
|1234567890 | 1058 | 323873436 | 2023-01-31 | 2022-12-07 |
+------------+----------------+---------------------+--------------+------------+
This table is from Google Ads data, so the column names are written in snake case. The query that generated this table would look similar to the following:
SELECT customer_id, metrics_clicks, metrics_cost_micros, DATE ('2023-01-31') AS _LATEST_DATE, DATE (_PARTITIONTIME) AS _DATA_DATE, FROM `DATASET`.p_ads_AccountBasicStats_CUSTOMER_ID` LIMIT 5
As this is only taking data from Google Ads, the view name is preceded
by the ads_
prefix and does not show any of the Adwords data.
If you were using Adwords prior to the migration, you see a view with the same
schema and column names. The data from the view is taken from Adwords data prior
to the date of migration, 2022-05-01
, and from Google Ads data
from after the migration.
The following table result shows columns from the AccountBasicStats
view. This
view is not preceded by the ads
prefix.
+-------------------+---------+---------------------+--------------+------------+
|ExternalCustomerId | Clicks | Cost | _LATEST_DATE | _DATA_DATE |
+-------------------+---------+---------------------+--------------+------------+
|1234567890 | 1212 | 430900867 | 2023-01-31 | 2022-12-07 |
|1234567890 | 1163 | 647597711 | 2023-01-31 | 2023-01-06 |
|1234567890 | 1156 | 384169744 | 2023-01-31 | 2022-12-11 |
|1234567890 | 1150 | 372517099 | 2023-01-31 | 2022-12-08 |
|1234567890 | 1058 | 323873436 | 2023-01-31 | 2022-12-07 |
+-------------------+---------+---------------------+--------------+------------+
The resulting table uses the old Adwords schema. The column names are in Pascal case. While the data looks similar to the previous table, the query that generates this view looks different, similar to the following:
SELECT ExternalCustomerId, Clicks, Cost, DATE ('2023-01-31') AS _LATEST_DATE, DATE (_PARTITIONTIME) AS _DATA_DATE, FROM `DATASET`.p_AccountBasicStats_CUSTOMER_ID` WHERE DATE(_PARTITIONTIME) <= DATE ('2022-05-01') UNION ALL SELECT customer_id AS ExternalCustomerId, metrics_clicks AS Clicks, metrics_cost_micros AS Cost, DATE ('2023-01-31') AS _LATEST_DATE, DATE (_PARTITIONTIME) AS _DATA_DATE, FROM `DATASET`.p_ads_AccountBasicStats_CUSTOMER_ID` WHERE DATE(_PARTITIONTIME) > DATE ('2022-05-01') LIMIT 5
The query takes data from Adwords before the date of migration, and data from Google Ads after migration, but displays all the information with the Adwords schema to avoid disrupting the typical workflow after converting to Google Ads.
PMax support
The Google Ads connector lets you export PMax campaigns data. You must select the Include PMax Campaign Tables checkbox when creating a data transfer, as PMax data is not exported by default.
Including PMax data removes
ad_group
fields from certain tables and includes new tables. You cannot include
ad_group
fields because the Google Ads API filters the PMax data.
The following tables exclude ad_group
related columns when the Include PMax
Campaign Tables checkbox is selected:
- GeoStats
- GeoConversionStats
- ShoppingProductConversionStats
- ShoppingProductStats
- LocationsUserLocationsStats
The following tables are added when the Include PMax Campaign Tables checkbox is selected:
- Asset
- AssetGroup
- AssetGroupAsset
- AssetGroupListingGroupFilter
- AssetGroupSignal
- Audience
- AssetGroupProductGroupStats
- CampaignAssetStats
Create Google Ads data transfer
To create a data transfer for Google Ads reporting, you need either your Google Ads customer ID or your manager account (MCC). For information about retrieving your Google Ads customer ID, see Find your Customer ID.
To create a data transfer for Google Ads reporting, select one of the following options:
Console
Go to the BigQuery page in the Google Cloud console.
Click
Data transfers.Click
Create transfer.In the Source type section, for Source, choose Google Ads.
In the Transfer config name section, for Display name, enter a name for the transfer such as
My Transfer
. The transfer name can be any value that lets you easily identify the transfer if you need to modify it later.In the Schedule options section:
For Repeats, choose an option for how often to run the transfer.
- Custom (default)
- Daily
- On-demand
If you select Custom or Daily, provide a custom schedule or valid time in UTC, respectively.
Leave the default value (Start now) or click Start at set time. If you selected On-demand earlier, then these options are disabled.
For Start date and run time, enter the date and time to start the transfer. If you choose Start now, this option is disabled.
In the Destination settings section, for Dataset, select the dataset that you created to store your data.
In the Data source details section:
For Customer ID, enter your Google Ads customer ID:
Optional: Select options to exclude removed/disabled items and include tables new to Google Ads.
Optional: Enter a comma-separated list of tables to include, for example
Campaign, AdGroup
. Prefix this list with the-
character to exclude certain tables, for example-Campaign, AdGroup
. All tables are included by default.Optional: Select the option to include tables specific to PMax reports. For more information about PMax support, see PMax support.
Optional: For Refresh window, enter a value between 1 and 30.
Optional: In the Notification options section:
Click the toggle to enable email notifications. When you enable this option, the transfer administrator receives an email notification when a transfer run fails.
Click the toggle to enable Pub/Sub notifications. For Select a Cloud Pub/Sub topic, choose your topic name or click Create a topic. This option configures Pub/Sub run notifications for your transfer.
Click Save.
bq
Enter the bq mk
command and supply the transfer creation flag —
--transfer_config
. The following flags are also required:
--data_source
--target_dataset
--display_name
--params
The following flags are optional:
--project_id
: Specifies which project to use. If the flag is not specified, the default project is used.--table_filter
: Specifies which tables to include in the transfer. If the flag is not specified, all tables are included. To include only specific tables, use a comma-separated list of values (for example,Ad
,Campaign
,AdGroup
). To exclude specific tables, prefix the values with a hyphen (-
) (for example,-Ad
,Campaign
,AdGroup
).
bq mk \ --transfer_config \ --project_id=project_id \ --target_dataset=dataset \ --display_name=name \ --params='parameters' \ --data_source=data_source \ --table_filter=tables
Where:
- project_id is your project ID.
- dataset is the target dataset for the transfer configuration.
- name is the display name for the transfer configuration. The transfer name can be any value that allows you to easily identify the transfer if you need to modify it later.
- parameters contains the parameters for the created transfer
configuration in JSON format. For example:
--params='{"param":"param_value"}'
. For Google Ads, you must supply thecustomer_id
parameter. You may optionally set theexclude_removed_items
parameter totrue
to prevent removed or disabled entities and metrics from being transferred. - data_source is the data source —
google_ads
. - tables is the comma-separated list of tables to include or exclude from the transfer.
For example, the following command creates a Google Ads transfer named
My Transfer
using Customer ID 123-123-1234
and target dataset
mydataset
. The transfer is created in the default project:
bq mk \
--transfer_config \
--target_dataset=mydataset \
--display_name='My Transfer' \
--params='{"customer_id":"123-123-1234","exclude_removed_items":"true"}' \
--data_source=google_ads
The first time you run the command, you receive a message like the following:
[URL omitted] Please copy and paste the above URL into your web browser and
follow the instructions to retrieve an authentication code.
Follow the instructions in the message and paste the authentication code on the command line.
API
Use the projects.locations.transferConfigs.create
method and supply an instance of the TransferConfig
resource.
Java
Before trying this sample, follow the Java setup instructions in the BigQuery quickstart using client libraries. For more information, see the BigQuery Java API reference documentation.
To authenticate to BigQuery, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Support for Google Ads manager accounts
Existing customers who have multiple Customer ID-specific Google Ads Transfers are encouraged to set up a single Google Ads Transfer at the Manager Account (MCC) level, schedule a backfill, and disable individual Customer ID-specific Google Ads Transfers.
Using Google Ads manager accounts provides several benefits over using individual Customer IDs:
- You no longer need to manage multiple transfers to report on multiple Customer IDs.
- Cross-customer queries are much simpler to write because all the Customer IDs are stored in the same table.
- Using MCCs alleviates BigQuery Data Transfer Service load quota issues because multiple Customer IDs are loaded in the same job.
For more information about Google Ads manager accounts (MCCs), see Working with managed accounts and About linking accounts to your manager account.
Example
The following list shows the Customer IDs linked to particular Google Ads manager accounts:
- 1234567890 — root manager account
- 1234 — sub-manager account
- 1111 — Customer ID
- 2222 — Customer ID
- 3333 — Customer ID
- 4444 — Customer ID
- 567 — sub-manager account
- 5555 — Customer ID
- 6666 — Customer ID
- 7777 — Customer ID
- 89 — sub-manager account
- 8888 — Customer ID
- 9999 — Customer ID
- 0000 — Customer ID
- 1234 — sub-manager account
Each Customer ID linked to a manager account appears in each report. For more information about the Google Ads reporting structure in BigQuery Data Transfer Service, see Google Ads report transformation.
Transfer configuration for Customer ID 1234567890
A transfer configuration for the root manager account (Customer ID 1234567890) would generate transfer runs that include the following Customer IDs:
- 1111 (via sub-manager account 1234)
- 2222 (via sub-manager account 1234)
- 3333 (via sub-manager account 1234)
- 4444 (via sub-manager account 1234)
- 5555 (via sub-manager account 567 and sub-manager account 1234)
- 6666 (via sub-manager account 567 and sub-manager account 1234)
- 7777 (via sub-manager account 567 and sub-manager account 1234)
- 8888 (via sub-manager account 89)
- 9999 (via sub-manager account 89)
- 0000 (individual Customer ID)
Transfer configuration for Customer ID 1234
A transfer configuration for sub-manager account 123 (Customer ID 1234) would generate transfer runs that include the following Customer IDs:
- 1111
- 2222
- 3333
- 4444
- 5555 (via sub-manager account 567)
- 6666 (via sub-manager account 567)
- 7777 (via sub-manager account 567)
Transfer configuration for Customer ID 567
A transfer configuration for sub-manager account 567 (Customer ID 567) would generate transfer runs that include the following Customer IDs:
- 5555
- 6666
- 7777
Transfer configuration for Customer ID 89
A transfer configuration for sub-manager account 89 (Customer ID 89) would generate transfer runs that include the following Customer IDs:
- 8888
- 9999
Transfer configuration for Customer ID 0000
A transfer configuration for Customer ID 0000 would generate transfer runs that include only the individual Customer ID:
- 0000
Migrate Google Ads data to MCCs
To migrate your existing Google Ads data in BigQuery Data Transfer Service to the MCC structure, you can set up a backfill to add your existing data to the tables created by the transfer configuration linked to the manager account. Note that when you schedule a backfill, match tables are not updated.
Troubleshoot Google Ads transfer setup
If you are having issues setting up your transfer, see Google Ads transfer issues in Troubleshooting transfer configurations.
Query your data
When your data is transferred to BigQuery Data Transfer Service, the data is written to ingestion-time partitioned tables. For more information, see Introduction to partitioned tables.
If you query your tables directly instead of using the auto-generated views, you
must use the _PARTITIONTIME
pseudo-column in your query. For more information,
see Querying partitioned tables.
Google Ads sample queries
You can use the following Google Ads sample queries to analyze your transferred data. You can also use the queries in a visualization tool such as Looker Studio. These queries are provided to help you get started on querying your Google Ads data with BigQuery Data Transfer Service. For additional questions about what you can do with these reports, contact your Google Ads technical representative.
In each of the following queries, replace dataset with your dataset name. Replace customer_id with your Google Ads Customer ID.
If you query your tables directly instead of using the auto-generated
views, you must use the _PARTITIONTIME
pseudo-column in your query. For more
information, see Querying partitioned tables.
Campaign performance
The following sample query analyzes Google Ads campaign performance for the past 30 days.
Console
SELECT c.customer_id, c.campaign_name, c.campaign_status, SUM(cs.metrics_impressions) AS Impressions, SUM(cs.metrics_interactions) AS Interactions, (SUM(cs.metrics_cost_micros) / 1000000) AS Cost FROM `DATASET.ads_Campaign_CUSTOMER_ID` c LEFT JOIN `DATASET.ads_CampaignBasicStats_CUSTOMER_ID` cs ON (c.campaign_id = cs.campaign_id AND cs._DATA_DATE BETWEEN DATE_ADD(CURRENT_DATE(), INTERVAL -31 DAY) AND DATE_ADD(CURRENT_DATE(), INTERVAL -1 DAY)) WHERE c._DATA_DATE = c._LATEST_DATE GROUP BY 1, 2, 3 ORDER BY Impressions DESC
bq
bq query --use_legacy_sql=false ' SELECT c.customer_id, c.campaign_name, c.campaign_status, SUM(cs.metrics_impressions) AS Impressions, SUM(cs.metrics_interactions) AS Interactions, (SUM(cs.metrics_cost_micros) / 1000000) AS Cost FROM `DATASET.ads_Campaign_CUSTOMER_ID` c LEFT JOIN `DATASET.ads_CampaignBasicStats_CUSTOMER_ID` cs ON (c.campaign_id = cs.campaign_id AND cs._DATA_DATE BETWEEN DATE_ADD(CURRENT_DATE(), INTERVAL -31 DAY) AND DATE_ADD(CURRENT_DATE(), INTERVAL -1 DAY)) WHERE c._DATA_DATE = c._LATEST_DATE GROUP BY 1, 2, 3 ORDER BY Impressions DESC'
Count of keywords
The following sample query analyzes keywords by campaign, ad group, and keyword
status. This query uses the KeywordMatchType
function. Keyword match types
help control which searches can trigger your ad. For more information about keyword
matching options, see
About keyword matching options.
Console
SELECT c.campaign_status AS CampaignStatus, a.ad_group_status AS AdGroupStatus, k.ad_group_criterion_status AS KeywordStatus, k.ad_group_criterion_keyword_match_type AS KeywordMatchType, COUNT(*) AS count FROM `DATASET.ads_Keyword_CUSTOMER_ID` k JOIN `DATASET.ads_Campaign_CUSTOMER_ID` c ON (k.campaign_id = c.campaign_id AND k._DATA_DATE = c._DATA_DATE) JOIN `DATASET.ads_AdGroup_CUSTOMER_ID` a ON (k.ad_group_id = a.ad_group_id AND k._DATA_DATE = a._DATA_DATE) WHERE k._DATA_DATE = k._LATEST_DATE GROUP BY 1, 2, 3, 4
bq
bq query --use_legacy_sql=false ' SELECT c.campaign_status AS CampaignStatus, a.ad_group_status AS AdGroupStatus, k.ad_group_criterion_status AS KeywordStatus, k.ad_group_criterion_keyword_match_type AS KeywordMatchType, COUNT(*) AS count FROM `DATASET.ads_Keyword_CUSTOMER_ID` k JOIN `DATASET.ads_Campaign_CUSTOMER_ID` c ON (k.campaign_id = c.campaign_id AND k._DATA_DATE = c._DATA_DATE) JOIN `DATASET.ads_AdGroup_CUSTOMER_ID` a ON (k.ad_group_id = a.ad_group_id AND k._DATA_DATE = a._DATA_DATE) WHERE k._DATA_DATE = k._LATEST_DATE GROUP BY 1, 2, 3, 4'
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-05-26 UTC.