API(上級)
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Google 広告スクリプトの高度な API を使用すると、経験豊富なデベロッパーは、HTTP インターフェースを使用する場合よりも少ない設定で、特定の公開 Google API に接続できます。これらの API は、スクリプトの組み込みサービスとほぼ同じように使用でき、自動補完や自動承認などの利便性も同じです。
API(上級)の用途
- Google アナリティクス 4
- Google アナリティクス 4 を使用してウェブサイトへのトラフィックをトラッキングし、それに応じてキャンペーンの入札単価を調整できます。Google アナリティクス 4 プロパティを Google 広告アカウントにリンクすると、ウェブサイトでのユーザー行動も分析できます。これにより、Google 広告経由のサイト閲覧数や売り上げを把握し、広告やサイトの改善に役立てることができます。アナリティクスと Google 広告アカウントのリンクについて詳しくは、Google アナリティクス 4 をご覧ください。
- Google BigQuery
- 大量のデータを Google Cloud Storage に読み込み、Google BigQuery を使用してそのデータをクエリできます。たとえば、過去 10 年間の公開天気データを読み込み、その情報を使用して入札単価を調整するスクリプトで、地域の平均気温をクエリできます。また、アカウントのパフォーマンス データを数年間にわたって分析する場合にも使用できます。
- YouTube と YouTube アナリティクス
- 動画、再生リストなどを取得して更新し、動画のパフォーマンス データに基づいて入札を決定できます。
- Google カレンダー
- スクリプトでは、将来のタスクのイベントを作成したり(たとえば、今日から 2 週間後のキャンペーンのパフォーマンス レポートを実行する)、カレンダーで作成したエントリに基づいてアクションを実行したりできます(たとえば、特定の日付にキャンペーンを有効にする)。
- ショッピング コンテンツ
- スクリプトでは、Apps Script で Google Content API for Shopping を使用できます。この API を使用すると、Google Merchant Center のユーザーは商品リスティングをアップロードして管理したり、Merchant Center アカウントを管理したりできます。スクリプトでは、商品リスティングを確認したり、特定の商品を特定の広告にリンクしたりする際に役立ちます。
- Google ToDo リスト
- スクリプトを使用すると、今後のタスクのリマインダー リストを作成したり(たとえば、今日から 2 週間後のキャンペーンのパフォーマンス レポートを実行する)、リマインダー リストで作成したエントリに基づいてアクションを実行したりできます(たとえば、特定の日付にキャンペーンを有効にする)。
- Google スライド
- スクリプトを使用して、キャンペーンの詳細や統計情報を Google スライドにエクスポートし、プレゼンテーション形式で公開できます。
高度な API を有効にする
高度な API として使用できる Google API を確認するには、エディタの上部にある [高度な API] ボタンをクリックします。

表示される [API(上級)] ダイアログで、有効にする API をオンにします。

次に、[Google API Console] リンクをクリックして、スクリプトに関連付けられているプロジェクトが選択された状態で、コンソールの [API Console] ページを表示します。プロジェクトがまだ選択されていない場合は、[プロジェクト] プルダウン リストから選択します。検索バーに API 名を入力して、スクリプトで使用する API を検索します。

検索結果で API を選択し、次のページで [有効にする] を選択します。[無効にする] ボタンが表示されている場合は、この API はすでに有効になっています。有効にする API それぞれに同じ操作を繰り返します。

プロジェクトで有効になっている API のリストを表示するには、[ダッシュボード] ページを選択します。スクリプトで使用するすべての高度な API がリストに表示されていることを確認します。

[API(上級)] ダイアログを閉じ、エディタに戻ります。新しい API がスクリプトで有効になり、予測入力リストで使用できるようになります。

使用可能な API
次の API を使用できます。
これらの API の使用例については、コード スニペットのページもご覧ください。
考慮事項
高度な API を使用する際は、次の点に注意してください。
プロジェクト ID
各 Google 広告スクリプトには、関連付けられた Google Cloud プロジェクト ID(プロジェクト番号とも呼ばれます)があります。スクリプトのプロジェクト番号は、[高度な API] ダイアログから Google API Console ページを開くと確認できます。このプロジェクト ID はスクリプトの作成時に作成され、Google 広告スクリプトを作成したユーザーに関連付けられます。スクリプトを作成したユーザーが後でアカウントから削除されると、スクリプトにアクセスしようとしたユーザーに、スクリプトの再承認と高度な API の依存関係の再設定を求めるメッセージが表示されます。新しい Google デベロッパー プロジェクト ID も作成されます。このドキュメントの前半で説明したように、高度な API を再度設定する必要があります。
依存関係
アカウントでスクリプトを作成したユーザーのみが、そのスクリプトの高度な API の依存関係を変更できます。
権限
API にアクセスする際、スクリプトはスクリプトを承認したユーザーの権限を使用します。スクリプトを承認したユーザーに、使用されているすべての高度な API と、スクリプトに必要なデータへのアクセス権があることを確認します。Google アナリティクス API を使用している場合は、スクリプトを承認したユーザーが、アクセスするアナリティクス アカウントに必要な権限を持っていることを確認します。
利用規約
各 Advanced API には独自の利用規約が適用される場合があります。Google API Console で API を有効にする際に、この利用規約に同意する必要があります。
割り当て
大部分の API(上級)には、1 日あたりの無料の使用量が割り当てられています。スクリプトがこの割り当てを超えると、追加のデータをリクエストするか、無料枠が補充されるまで API は動作を停止します。スクリプトで使用されている割り当てをモニタリングするには、[高度な API] ダイアログからスクリプトの Google API Console を開きます。Google API Console では、API の追加割り当てをリクエストすることもできます。
課金
一部の Advanced API では、使用料金を支払う必要があります。これらの支払いは、Google 広告ではなく、スクリプトに関連付けられた Google Cloud プロジェクトを通じて管理されます。スクリプトの Google Cloud プロジェクトで課金を有効にする方法の詳細については、ドキュメントをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-31 UTC。
[null,null,["最終更新日 2025-08-31 UTC。"],[[["\u003cp\u003eAdvanced APIs in Google Ads scripts allow experienced developers to connect to public Google APIs like Google Analytics, BigQuery, YouTube, and more with simplified setup.\u003c/p\u003e\n"],["\u003cp\u003eThese APIs offer conveniences such as auto-completion and automatic authorization, similar to built-in scripts services.\u003c/p\u003e\n"],["\u003cp\u003eTo enable Advanced APIs, users need to select them in the script editor, enable them in the Google API Console, and ensure the authorized user has necessary permissions.\u003c/p\u003e\n"],["\u003cp\u003eScripts utilize the authorized user's permissions and are subject to each API's terms, conditions, quotas, and potential billing for usage.\u003c/p\u003e\n"],["\u003cp\u003eEach script has an associated Google Cloud Platform Project ID, tied to the creator, which might require reauthorization and setup if the creator is removed from the account.\u003c/p\u003e\n"]]],[],null,["# Advanced APIs\n\nThe advanced APIs in Google Ads scripts let experienced developers connect\nto certain public Google APIs with less setup than using their HTTP interfaces.\nYou use these APIs much like scripts' built-in services, and they offer the same\nconveniences like auto-completion and automatic authorization.\n\nPossible uses for Advanced APIs\n-------------------------------\n\nGoogle Analytics 4\n: You can use Google Analytics 4 to track the traffic coming to your website and\n adjust your campaign bids accordingly. If you link a Google Analytics 4 property\n to your Google Ads account, you can also analyze customer activity on your\n website. This information can shed light on how much of your website traffic or\n sales comes from Google Ads and help you improve your ads and website. You can\n learn more about linking Analytics and Google Ads accounts through\n [Google Analytics 4](//support.google.com/analytics/answer/10089681).\n\nGoogle BigQuery\n: You can load large quantities of data into Google Cloud Storage, and then\n query that data using Google BigQuery. For example, you can load public weather\n data for the past 10 years and then query for a region's average temperature in\n a script that uses that information in adjusting bids. Another use would be to\n do number crunching over your account's performance data over several years.\n\nYouTube and YouTube Analytics\n: You can retrieve and update your videos, playlists, etc. as well as your\n videos' performance data to make bidding decisions.\n\nGoogle Calendar\n: Your script can create events for future tasks (for example, run a\n performance report for your campaigns 2 weeks from today), or perform actions\n based on an entry you created on your calendar (for example, enable a campaign\n on a specific date).\n\nShopping Content\n: Your script can use the Google Content API for Shopping in Apps Script. This\n API gives Google Merchant Center users the ability to upload and manage their\n product listings and manage their Merchant Center accounts. In scripts, this\n can be useful to check product listings and link specific products to specific\n ads.\n\nGoogle Tasks\n: Your script can create a reminder list for future tasks (for example, run a\n performance report for your campaigns two weeks from today), or perform actions\n based on an entry you created in your reminder list (for example, enable a\n campaign on a specific date).\n\nGoogle Slides\n: Your script can export campaign details or statistics to Google Slides to\n publish such information in a presentable format.\n\nEnable Advanced APIs\n--------------------\n\nTo see which Google APIs are available as advanced APIs, click the **Advanced\nAPIs** button on the top editor bar.\n\nThis brings up the **Advanced APIs** dialog. Check the APIs you want to enable.\n\nNext, click the **Google API Console** link to bring up the **API Console**\npage in the Console, with the project associated with your script; or, if\nyour project is not already selected, select it from the Project drop-down\nlist. Search for the APIs you want to use in your script by entering the API\nname in the search bar.\n\nIn the search results, select the API, and on the following page choose\n**Enable** ; if you see a **Disable** button, then this API is already\nenabled. Repeat this action for each API you want to enable.\n\nTo view the list of enabled APIs for the project, select the **Dashboard**\npage. Verify that all the Advanced APIs you want to use for the script are\nlisted.\n\nNow close the Advanced APIs dialog to return to your editor. The new APIs\nwill be enabled for your script and available in the autocomplete list.\n\nAvailable APIs\n--------------\n\nThe following APIs are available for use:\n\n| API Name | Documentation |\n|-------------------|-----------------------------------------------------------------------------------------------------------------|\n| Google Analytics | [https://developers.google.com/apps-script/advanced/analytics](/apps-script/advanced/analytics) |\n| Google BigQuery | [https://developers.google.com/apps-script/advanced/bigquery](/apps-script/advanced/bigquery) |\n| Google Calendar | [https://developers.google.com/apps-script/advanced/calendar](/apps-script/advanced/calendar) |\n| Google Slides | [https://developers.google.com/apps-script/advanced/slides](/apps-script/advanced/slides) |\n| Google Tasks | [https://developers.google.com/apps-script/advanced/tasks](/apps-script/advanced/tasks) |\n| Shopping Content | [https://developers.google.com/apps-script/advanced/shopping-content](/apps-script/advanced/shopping-content) |\n| YouTube | [https://developers.google.com/apps-script/advanced/youtube](/apps-script/advanced/youtube) |\n| YouTube Analytics | [https://developers.google.com/apps-script/advanced/youtube-analytics](/apps-script/advanced/youtube-analytics) |\n\nYou can also refer to our [code snippets page](/google-ads/scripts/docs/examples)\nfor some examples on how to use these APIs.\n\nFinal considerations\n--------------------\n\nThere are a few things to keep in mind when working with the Advanced APIs.\n\n### Project ID\n\nEach Google Ads script has a Google Cloud\n[Project ID](//support.google.com/cloud/answer/6158853)\n(also known as a project number) associated with it. You can find your script's\nproject number by opening the Google API Console page from the **Advanced APIs**\ndialog. This project ID is created when you create the script, and is tied to\nthe user who created the Google Ads script. If the user who created the script\nis later removed from the account, then a user trying to access the script will\nbe prompted to reauthorize the script and setup Advanced API dependencies again.\nA new Google Developer Project ID will also be created, and you will need to\nsetup the Advanced APIs again, as explained earlier in this document.\n\n### Dependencies\n\nOnly the user who created the script in the account can change the Advanced\nAPIs dependencies for that script.\n\n### Permissions\n\nWhen accessing the APIs, a script uses the permissions of the user who\nauthorized the script. Make sure that the user who authorized the script has the\nrequired access to all Advanced APIs being used as well as the data the script\nneeds. If you are using the Google Analytics API, verify that the user who\nauthorized the script has the necessary permissions for the Analytics account\nbeing accessed.\n\n### Terms and Conditions\n\nEach of the Advanced APIs may have its own Terms and Conditions which you\nshould accept when enabling the API in the Google API Console.\n\n### Quota\n\nMost Advanced APIs have a free daily quota associated with it. Once your script\nexceeds this quota, the API will stop working until you request additional\ndata, or the free quota is replenished. You can\n[monitor](//support.google.com/cloud/answer/6158858) the quota used by your\nscript by opening the Google API Console for the script from the **Advanced\nAPIs** dialog. The Google API Console also provides you a way to request\nadditional quota for the API.\n\n### Billing\n\nSome Advanced APIs require you to pay for usage. These payments are managed\nthrough the Google Cloud project associated with your script, and not through\nGoogle Ads. See our\n[documentation](//support.google.com/cloud/answer/6158867) for more details on\nhow to enable billing for your script's Google Cloud project."]]