Advanced APIs

  • 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
You can use Google Analytics to track the traffic coming to your website and adjust your campaign bids accordingly. If you link a Google Analytics property to your Google Ads account, you can also analyze customer activity on your website. This information can shed light on how much of your website traffic or sales comes from Google Ads and help you improve your ads and website. You can learn more about linking Analytics and Google Ads accounts through the Set up Analytics for a website and/or app Help Center 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 the APIs, a script uses the permissions of the user who authorized the script. Make sure that the user who authorized the script has the required access to all the data the script needs. If you are using the Google Analytics API, verify that the user who authorized the script has the necessary permissions for the Analytics account being accessed.

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:

  1. Click the Advanced APIs button. In the following dialog window, click the link to the Google Cloud Console.
  2. If your project is not already selected, select it from the Project drop-down list.
  3. Search for the APIs you want to use in your script by entering the API name in the search bar.
  4. 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.