The advanced APIs in Google Ads scripts let experienced developers connect
to certain public Google APIs with less setup than using their HTTP interfaces.
You use these APIs much like scripts' built-in services, and they offer the same
conveniences like auto-completion and automatic authorization.
Possible uses for 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 on our
help
center
.
- 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.
- YouTube and YouTube Analytics
- You can retrieve and update your videos, playlists, etc. as well as your
videos' performance data to make bidding decisions.
- 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).
- Shopping Content
- Your script can use the Google Content API for Shopping in Apps Script. This
API gives Google Merchant Center users the ability to upload and manage their
product listings and manage their Merchant Center accounts. In scripts, this
can be useful to check product listings and link specific products to specific
ads.
- 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).
- Google Slides
- Your script can export campaign details or statistics to Google Slides to
publish such information in a presentable format.
Enable Advanced APIs
To see which Google APIs are available as advanced APIs, click the
Advanced
APIs
button on the top editor bar.
This brings up the
Advanced APIs
dialog. Check the APIs you wish to enable.
Next, click the
Google API Console
link to bring up the
API Console
page in the Console, with the project associated with your script; or, if
your project is not already selected, select it from the Project drop-down
list. Search for the APIs you wish to use in your script by entering the API
name in the search bar.
In the search results, select the API, and on the following page choose
Enable
; if you see a
Disable
button, then this API is already
enabled. Repeat this action for each API you want to enable.
To view the list of enabled APIs for the project, select the
Dashboard
page. Verify that all the Advanced APIs you want to use for the script are
listed.
Now close the Advanced APIs dialog to return to your editor. The new APIs
will be enabled for your script and available in the autocomplete list.
Available APIs
The following APIs are available for use:
You can also refer to our
code snippets
page
for some examples on how to use
these APIs.
Final considerations
There are a few things to keep in mind when working with the Advanced APIs.
Project ID
Each Google Ads script has a Google Cloud Platform
Project
ID
(also known as a project number)
associated with it. You can find your script’s project number by opening the
Google API Console page from the
Advanced APIs
dialog. This project ID is
created when you create the script, and is tied to the user who created the
Google Ads script. If the user who created the script is later removed from the
account, then a user trying to access the script will be prompted to
reauthorize the script and setup Advanced API dependencies again. A new Google
Developer Project ID will also be created, and you will need to setup the
Advanced APIs again, as explained earlier in this document.
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. Ensure that the user who authorized the script has the
required access to all Advanced APIs being used as well as the data the script
needs. If you are using the Google Analytics API, ensure that the user who
authorized the script has the necessary permissions for the Analytics account
being accessed.
Terms and Conditions
Each of the Advanced APIs may have its own Terms and Conditions which you
should accept when enabling the API in the Google API Console.
Quota
Most Advanced APIs have a free daily quota associated with it. Once your script
exceeds this quota, the API will stop working until you request additional
data, or the free quota is replenished. You can
monitor
the quota used by your
script by opening the Google API Console for the script from the
Advanced
APIs
dialog. The Google API Console also provides you a way to request
additional quota for the API.
Billing
Some Advanced APIs require you to pay for usage. These payments are managed
through the Google Cloud Platform project associated with your script, and not
through Google Ads. See our
documentation
for more details on
how to enable billing for your script's Google Cloud Platform project.