บริการ AdSense ช่วยให้คุณสามารถใช้ AdSense Management API ใน Apps Script API นี้ ทำให้ลูกค้า AdSense สามารถดูข้อมูลเกี่ยวกับโครงสร้าง ของบัญชี และเรียกใช้รายงานเกี่ยวกับประสิทธิภาพของบัญชี
ข้อมูลอ้างอิง
สำหรับข้อมูลโดยละเอียดเกี่ยวกับบริการนี้ โปรดดูที่ เอกสารอ้างอิงสำหรับ AdSense API การจัดการ เช่นเดียวกับบริการขั้นสูงทั้งหมดใน Apps Script บริการ AdSense ใช้ออบเจ็กต์ เมธอด และพารามิเตอร์เดียวกันกับ API สาธารณะ ดูข้อมูลเพิ่มเติมได้ที่วิธีกำหนดลายเซ็นของเมธอด
หากต้องการรายงานปัญหาและค้นหาการสนับสนุนอื่นๆ โปรดสอบถามใน Stack Overflow โดยใช้ adsense-api แท็ก
โค้ดตัวอย่าง
โค้ดตัวอย่างด้านล่างใช้เวอร์ชัน 2 ของ API
แสดงรายการบัญชี
ตัวอย่างนี้แสดงบัญชีทั้งหมดที่ผู้ใช้สามารถใช้ได้ บัญชีเหล่านี้
ระบุเป็นชื่อทรัพยากร เช่น accounts/pub-12345
ที่สามารถใช้ได้
วิธีอื่นๆ เช่น การแสดงรายชื่อไคลเอ็นต์โฆษณา สังเกตเห็นการใช้งาน
ของหน้าเพื่อเข้าถึงรายการผลลัพธ์ทั้งหมด
แสดงรายการไคลเอ็นต์โฆษณา
ตัวอย่างนี้แสดงไคลเอ็นต์โฆษณาทั้งหมดของบัญชีหนึ่งๆ ระบุบัญชี
เป็นชื่อทรัพยากร เช่น accounts/pub-12345
คุณสามารถสร้างบัญชี
ชื่อทรัพยากรโดยใช้โค้ดตัวอย่างแสดงรายการบัญชี
แสดงรายการหน่วยโฆษณา
ตัวอย่างนี้แสดงหน่วยโฆษณาทั้งหมดของไคลเอ็นต์โฆษณาหนึ่งๆ ระบุโฆษณา
เป็นชื่อทรัพยากร เช่น accounts/pub-12345/adclients/ca-pub-12345
คุณสามารถดูชื่อทรัพยากรไคลเอ็นต์โฆษณาได้โดยใช้
โค้ดตัวอย่างแสดงรายการไคลเอ็นต์โฆษณา
สร้างรายงาน
ตัวอย่างนี้จะสร้างรายงานจากบัญชี AdSense ของคุณและแสดงผล ผลลัพธ์ไปยังสเปรดชีต