AdSense 服務
AdSense 服務可讓您在 Apps Script 中使用 AdSense Management API。這個 API 可讓 AdSense 客戶取得帳戶結構相關資訊,並執行成效報表。
參考資料
如要進一步瞭解這項服務,請參閱 AdSense Management API 的參考文件。與 Apps Script 中的所有進階服務一樣,AdSense 服務會使用與公用 API 相同的物件、方法和參數。詳情請參閱「如何決定方法簽章」。
如要回報問題或尋求其他支援,請在 Stack Overflow 上使用 adsense-api 標記提問。
程式碼範例
以下程式碼範例使用 API 的 第 2 版。
列出帳戶
這個範例會列出使用者可用的所有帳戶。帳戶會指定為資源名稱 (例如 accounts/pub-12345
),可用於其他方法,例如列出廣告客戶。請注意,您必須使用頁面符記才能存取完整的結果清單。
列出廣告客戶
這個範例會列出指定帳戶的所有廣告客戶。將帳戶指定為資源名稱,例如 accounts/pub-12345
。您可以使用「列出帳戶」範例程式碼取得帳戶資源名稱。
列出廣告單元
這個範例會列出指定廣告客戶的所有廣告單元。將廣告客戶端指定為資源名稱,例如 accounts/pub-12345/adclients/ca-pub-12345
。您可以使用「列出廣告客戶」範例程式碼,取得廣告客戶資源名稱。
產生報表
這個範例會針對您的 AdSense 帳戶產生報表,並將結果輸出至試算表。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-12-21 (世界標準時間)。
[null,null,["上次更新時間:2024-12-21 (世界標準時間)。"],[[["The AdSense Management API allows you to programmatically access your AdSense account data within Google Apps Script."],["You can retrieve information about your account structure, including accounts, ad clients, and ad units."],["This API enables you to generate reports on your AdSense performance and export them to a Google Sheet."],["This is an advanced service that needs to be enabled before use, offering functionality similar to the public AdSense Management API."]]],[]]