Page Summary
-
Google Ads scripts allow developers to connect to certain public Google APIs with less setup, offering conveniences like auto-completion and automatic authorization.
-
Advanced APIs can be used for various purposes including tracking website traffic with Google Analytics 4, analyzing large data sets with Google BigQuery, managing YouTube content, scheduling tasks with Google Calendar and Tasks, managing Shopping content, and exporting data to Google Slides.
-
To use Advanced APIs, you need to enable them within Google Ads scripts and in the associated Google API Console project.
-
Important considerations when using Advanced APIs include understanding Project IDs, dependencies, user permissions, individual API terms and conditions, daily quotas, and potential billing requirements.
The advanced APIs in Google Ads scripts let developers connect to certain public Google APIs with less setup than using their HTTP interfaces. You can use these APIs much like scripts' built-in services, and they offer the same conveniences like auto-completion and automatic authorization.
Refer to our code snippets page for some examples that show how to use these APIs.
Available advanced APIs
- Google Analytics
- Note: The
Analyticsadvanced API in the Advanced APIs dialog targets the shut-down Universal Analytics v3 API, and requests to it fail. Google Ads scripts don't support the Google Analytics 4AnalyticsDataorAnalyticsAdminadvanced services. To query Google Analytics 4 data from a script, send HTTPS requests to the Google Analytics Data API by using theUrlFetchAppservice and OAuth 2.0. You can also link a Google Analytics 4 property to your Google Ads account to share website and app conversion data directly. For setup instructions, see the Analytics setup guide. - Google BigQuery
- You can load large quantities of data into Google Cloud Storage, and then query that data using Google BigQuery. For example, you can load public weather data for the past 10 years and then query for a region's average temperature in a script that uses that information in adjusting bids. Another use would be to do number crunching over your account's performance data over several years.
- Google Calendar
- Your script can create events for future tasks (for example, run a performance report for your campaigns 2 weeks from today), or perform actions based on an entry you created on your calendar (for example, enable a campaign on a specific date).
- Google Slides
- Your script can export campaign details or statistics to Google Slides to publish such information in a presentable format.
- Google Tasks
- Your script can create a reminder list for future tasks (for example, run a performance report for your campaigns two weeks from today), or perform actions based on an entry you created in your reminder list (for example, enable a campaign on a specific date).
- Merchant API
- Your script can use the Merchant API to to upload and manage your product listings and manage your Google Merchant Center accounts. In scripts, this can be useful to check product listings and link specific products to specific ads. The Merchant API has sub-APIs that can be individually enabled in the Advanced APIs dialog. You can learn more about linking your Google Merchant Center account through the Register as a developer guide.
- Shopping Content
- Your script can use the Google Content API for Shopping to upload and manage your product listings and manage your Google Merchant Center accounts. In scripts, this can be useful to check product listings and link specific products to specific ads. Note: the Content API for Shopping will be sunset on August 18, 2026. Use the Merchant API, which is described in the previous section, instead.
- YouTube and YouTube Analytics
- You can retrieve and update your videos, playlists, etc. as well as your videos' performance data to make bidding decisions.
Enable advanced APIs
To see which Google APIs are available as advanced APIs, click Advanced APIs in the top editor bar to display the Advanced APIs dialog. Select the APIs you want to enable.
Click Save to save your selections and return to the scripts editor. The new APIs will be enabled for your script and available in the autocomplete list.
Additional considerations
There are a few things to keep in mind when working with the advanced APIs.
Dependencies
Only the user who created the script in the account can change the advanced APIs dependencies for that script.
Permissions
When accessing advanced APIs, a script uses the permissions of the user who
authorized the script. The authorizing user must have the required access to all
the data that the script needs. For example, to use the BigQuery advanced API,
the authorizing user must have the required permissions for the target Google
Cloud project and BigQuery dataset.
Considerations for scripts from before May 2019
For scripts created before May 2019, you may need to manually enable the relevant APIs in the script's associated Google Cloud Project. You'll know if your script is impacted if you see a link to the Google Cloud Console in the advanced APIs dialog.
Enable advanced APIs
For pre-2019 scripts, you'll need to manually enable each advanced API you'd like to use in your script:
- Click the Advanced APIs button. In the following dialog window, click the link to the Google Cloud Console.
- If your project is not already selected, select it from the Project drop-down list.
- Search for the APIs you want to use in your script by entering the API name in the search bar.
- Select the API from the search results, and click the "Enable" button on the subsequent page.
If the user who created the script is later removed from the account, then any new user trying to access the script will be prompted to enable the advanced API dependencies again, as well as reauthorize the script.