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](https://developers.google.com/google-ads/scripts/docs/examples) for some examples that show how to
use these APIs.

## Available advanced APIs

Google Analytics
:   **Note:** The `Analytics` advanced 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 4 `AnalyticsData` or `AnalyticsAdmin`
    advanced services. To query Google Analytics 4 data from a script, send HTTPS
    requests to the [Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1/rest) by using the
    `UrlFetchApp` service and [OAuth 2.0](https://developers.google.com/google-ads/scripts/docs/integrations/third-party-apis#oauth_2). 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](https://support.google.com/analytics/answer/9304153).

[Google BigQuery](https://developers.google.com/apps-script/advanced/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](https://developers.google.com/apps-script/advanced/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](https://developers.google.com/apps-script/advanced/slides)
:   Your script can export campaign details or statistics to Google Slides to
    publish such information in a presentable format.

[Google Tasks](https://developers.google.com/apps-script/advanced/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](https://developers.google.com/apps-script/advanced/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](https://developers.google.com/merchant/api/guides/quickstart/registration) guide.

[Shopping Content](https://developers.google.com/apps-script/advanced/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](https://developers.google.com/youtube/data/guides/authentication) and [YouTube Analytics](https://developers.google.com/youtube/reporting)
:   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:

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.