ภาพรวม
วิธีการต่อไปนี้แสดงตัวอย่างวิธีค้นหาทั้งการเข้าชมที่มองเห็นโฆษณาได้และถูกต้อง และการเข้าชมที่ไม่ถูกต้องโดยใช้ API เมตริกเหล่านี้จำกัดเฉพาะพื้นที่โฆษณาที่ซื้อโดยใช้ Google Ads และ Display & Video 360
โปรดทราบว่าเมตริกการดู TrueView ที่ได้รับการรับรองจาก MRC ต้องใช้ ADH API เนื่องจากไม่มีการค้นหาที่ใช้เทมเพลตที่เชื่อมโยง นอกจากนี้ โปรดอย่าสับสนระหว่างเมตริกยอดดู TrueView กับเมตริกการมองเห็นโฆษณา
เลือกช่องทางการซื้อที่ต้องการค้นหาเมตริกการมองเห็นโฆษณา ดังนี้
ค้นหาเมตริกการมองเห็นโฆษณาโดยใช้ UI
การค้นหาการมองเห็นโฆษณาที่มีเทมเพลตจะแสดงเมตริกที่ MRC รับรอง
การรับรองของ MRC เป็นแบบไบนารี กล่าวคือ ผลลัพธ์อาจได้รับการรับรองหรือไม่ก็ได้ และมีผลกับตารางผลลัพธ์ทั้งหมด คุณต้องเรียกใช้การค้นหาผ่านเทมเพลตโดยไม่ต้องแก้ไข และอยู่ในโหมดการตรวจหาข้อมูลที่ต่างกันเพื่อให้เมตริกได้รับการรับรองจาก MRC การรับรอง MRC ของ Ads Data Hub ไม่ครอบคลุมการค้นหาที่เรียกใช้ในโหมด Noise Injection
วิธีเรียกใช้การค้นหาที่ผ่านการรับรองจาก MRC ผ่านเทมเพลต
- ทำตามวิธีการวิธีสร้างการค้นหา โดยตรวจสอบว่าคุณเลือก Google Ads เป็นช่องทางการซื้อ และการมองเห็นโฆษณาวิดีโอตามประเภทอุปกรณ์เป็นเทมเพลตการค้นหา
- คลิกปุ่มเรียกใช้ข้างใช้เทมเพลต
ค้นหาเมตริกการเข้าชมที่ไม่ถูกต้องและการมองเห็นโฆษณาโดยใช้ API
คุณสามารถดึงข้อมูลเมตริกการเข้าชมที่ไม่ถูกต้องและการมองเห็นโฆษณาได้จาก ADH API โดยใช้ปลายทาง generateIvtReport และ startAnalysis สำหรับการเข้าชมที่ไม่ถูกต้อง คุณต้องดึงข้อมูลเมตริกผ่าน generateIvtReport เพื่อให้ระบบใช้ป้ายกำกับ adh-mrc-accredited และเมตริกได้รับการรับรองจาก MRC ในทำนองเดียวกัน คุณต้องใช้การค้นหาทั่วโลกที่ระบุด้านล่างสำหรับเมตริกการมองเห็นโฆษณาผ่าน ADH API เพื่อให้ได้รับการรับรองจาก MRC ส่วนนี้จะอธิบายวิธีส่งคำขอไปยังปลายทางนี้โดยใช้ไลบรารีของไคลเอ็นต์ Python
ทำตามวิธีการตั้งค่าและการให้สิทธิ์/การตรวจสอบสิทธิ์ในคู่มือเริ่มใช้งาน API ฉบับย่อ
หลังจากแทนที่ช่องต่อไปนี้ด้วยข้อมูลที่เกี่ยวข้องกับบัญชีแล้ว คุณสามารถเรียกใช้การค้นหาด้านล่างเพื่อเรียกข้อมูลรายงานการเข้าชมที่ไม่ถูกต้องสำหรับแคมเปญ Google Ads ได้
- ไฟล์รหัสลับไคลเอ็นต์
- รหัสลูกค้า
- คีย์ API
- Campaign IDs
- เขตเวลา
โค้ดตัวอย่าง
การเข้าชมที่ไม่ถูกต้อง
import json
import os.path
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
# If modifying these scopes, delete the file `token.json`.
SCOPES = ['https://www.googleapis.com/auth/adsdatahub']
TOKEN_FILE = 'token.json'
creds = None
# The file token.json stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists(TOKEN_FILE):
creds = Credentials.from_authorized_user_file(TOKEN_FILE, SCOPES)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'YOUR_CLIENT_SECRETS.json', SCOPES)
creds = flow.run_local_server(port=0)
# Save the credentials for the next run.
with open(TOKEN_FILE, 'w') as token:
token.write(creds.to_json())
service = build('adsdatahub', 'v1', credentials=creds,
developerKey='YOUR_API_KEY', static_discovery=False)
body = {
'ads_data_customer_id': YOUR_CUSTOMER_ID,
'start_date': {
'year': 2019,
'month': 12,
'day': 15
},
'end_date': {
'year': 2019,
'month': 12,
'day': 20
},
'time_zone': 'YOUR_TIMEZONE',
# Optional. Defaults to 'DAY' (one set of rows per day). Use
# 'ENTIRE_DATE_RANGE' for a single set of rows covering the whole range.
'date_dimension_granularity': 'DAY',
'google_ads_dimensions': {
'campaign_ids': [YOUR_CAMPAIGN_IDS],
'metric_type': 'METRIC_TYPE_IMPRESSION'
},
'dest_table': 'YOUR_DESTINATION_TABLE'
}
resp = service.customers().generateIvtReport(
name='customers/YOUR_CUSTOMER_ID', body=body).execute()
print(json.dumps(resp))
เมตริกการมองเห็นโฆษณา
import json
import os.path
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
# If modifying these scopes, delete the file `token.json`.
SCOPES = ['https://www.googleapis.com/auth/adsdatahub']
TOKEN_FILE = 'token.json'
creds = None
# The file token.json stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists(TOKEN_FILE):
creds = Credentials.from_authorized_user_file(TOKEN_FILE, SCOPES)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'YOUR_CLIENT_SECRETS.json', SCOPES)
creds = flow.run_local_server(port=0)
# Save the credentials for the next run.
with open(TOKEN_FILE, 'w') as token:
token.write(creds.to_json())
service = build('adsdatahub', 'v1', credentials=creds,
developerKey='YOUR_API_KEY', static_discovery=False)
name = 'customers/global/analysisQueries/f41320e7296d49158e572aba662f35b1'
body = {
'spec': {
'ads_data_customer_id': YOUR_CUSTOMER_ID,
'start_date': {
'year': 2019,
'month': 12,
'day': 15
},
'end_date': {
'year': 2019,
'month': 12,
'day': 20
},
'time_zone': 'YOUR_TIMEZONE',
'parameter_values': {
'campaign_ids': {
'array_value': {
'values': [
{
'value': 'YOUR_CAMPAIGN_ID'
},
]
}
}
}
},
'dest_table': 'YOUR_DESTINATION_TABLE',
'customer_id': YOUR_CUSTOMER_ID
}
resp = service.customers().analysisQueries().start(name=name,body=body).execute()
print(json.dumps(resp))
คำนวณเมตริกการมองเห็นโฆษณาสุทธิของการเข้าชมที่ไม่ถูกต้องแบบทั่วไป
ใช้สูตรต่อไปนี้เพื่อรับเมตริกการมองเห็นโฆษณาที่ได้รับการรับรองจาก MRC สุทธิจากการเข้าชมที่ไม่ถูกต้องแบบทั่วไป (GIVT)
- การแสดงผลทั้งหมด (สุทธิของ GIVT): การแสดงผลทั้งหมด - การแสดงผลที่ไม่ถูกต้องแบบทั่วไป
- การแสดงผลที่มองเห็นได้ (สุทธิของ GIVT): การแสดงผลที่มองเห็นได้ + การแสดงผลที่มองเห็นได้ที่ไม่ถูกต้อง - การแสดงผลที่มองเห็นได้ใน GIVT
- การแสดงผลที่วัดได้ (สุทธิของ GIVT): การแสดงผลที่วัดได้ + การแสดงผลที่วัดได้ที่ไม่ถูกต้อง - การแสดงผลที่วัดได้ใน GIVT
- การแสดงผลที่มีสิทธิ์ (GIVT สุทธิ): การแสดงผลที่มีสิทธิ์ + การแสดงผลที่มีสิทธิ์ที่ไม่ถูกต้อง - การแสดงผลที่มีสิทธิ์ของ GIVT
- การแสดงผลที่มองไม่เห็น (GIVT สุทธิ) : การแสดงผลที่วัดได้ (GIVT สุทธิ) - การแสดงผลที่มองเห็นได้ (GIVT สุทธิ)
- การแสดงผลที่วัดไม่ได้ (GIVT สุทธิ): การแสดงผลที่มีสิทธิ์ (GIVT สุทธิ) - การแสดงผลที่วัดได้ (GIVT สุทธิ)
- % การแสดงผลที่วัดได้ (GIVT สุทธิ): การแสดงผลที่วัดได้ (GIVT สุทธิ) / การแสดงผลที่มีสิทธิ์ (GIVT สุทธิ)
- % การแสดงผลที่มองเห็นได้ (GIVT สุทธิ): การแสดงผลที่มองเห็นได้ (GIVT สุทธิ) / การแสดงผลที่วัดได้ (GIVT สุทธิ)