ภาพรวม
วิธีการด้านล่างนี้แสดงตัวอย่างวิธีค้นหาการเข้าชมการมองเห็นโฆษณาที่ถูกต้องและการเข้าชมที่ไม่ถูกต้องโดยใช้ API เมตริกเหล่านี้จำกัดเฉพาะพื้นที่โฆษณาที่ซื้อโดยใช้ Google Ads, Display & Video 360 และ YouTube Reserve
โปรดทราบว่าเมตริกยอดดู TrueViewการดู TrueView ที่ได้รับการรับรองจาก MRC ต้องใช้ ADH API เนื่องจากไม่มีการค้นหาที่ใช้เทมเพลตที่เกี่ยวข้อง นอกจากนี้ โปรดอย่าสับสนระหว่างเมตริกยอดดู TrueView กับเมตริกการมองเห็นโฆษณา
เลือกช่องทางการซื้อที่คุณต้องการค้นหาเมตริกการมองเห็น
ค้นหาเมตริกการมองเห็นโฆษณาโดยใช้ UI
คําค้นหาความสามารถในการมองเห็นโฆษณาที่สร้างจากเทมเพลตจะให้เมตริกที่ได้รับการรับรองจาก MRC
การรับรอง MRC เป็นแบบไบนารี ซึ่งหมายความว่าผลลัพธ์ของคุณจะได้รับการรับรองหรือไม่ก็ได้ และการรับรองนี้จะมีผลกับตารางผลลัพธ์ทั้งหมด ใน BigQuery ระบบจะใช้ป้ายกำกับ adh-mrc-accredited กับผลลัพธ์ทั้งหมดที่ได้รับการรับรองจาก MRC คุณต้องเรียกใช้การค้นหาผ่านเทมเพลตเพื่อให้เมตริกได้รับการรับรองจาก MRC
วิธีเรียกใช้การค้นหาที่ได้รับการรับรองจาก MRC ผ่านเทมเพลต
- ทำตามวิธีการสร้างคําค้นหา โดยตรวจสอบว่าคุณเลือก Google Ads เป็นช่องทางการซื้อ และการมองเห็นโฆษณาวิดีโอเป็นเทมเพลตคําค้นหา
- คลิกปุ่มเรียกใช้ข้างใช้เทมเพลต
ค้นหาเมตริกการเข้าชมที่ไม่ถูกต้องและความสามารถในการมองเห็นโดยใช้ API
คุณสามารถดึงเมตริกการเข้าชมที่ไม่ถูกต้องและการมองเห็นโฆษณาจาก ADH API ได้โดยใช้ปลายทาง generateIvtReport และ startAnalysis สำหรับจำนวนการเข้าชมที่ไม่ถูกต้อง คุณต้องดึงข้อมูลเมตริกผ่านgenerateIvtReport เพื่อให้ระบบใช้adh-mrc-accredited ป้ายกำกับและเมตริกได้รับการรับรองจาก MRC ในทํานองเดียวกัน คุณต้องใช้การค้นหาทั่วโลกที่ระบุไว้ด้านล่างสําหรับเมตริกความสามารถในการมองเห็นผ่าน ADH API เพื่อการรับรอง MRC ส่วนนี้จะครอบคลุมวิธีส่งคำขอไปยังปลายทางนี้โดยใช้ไลบรารีของไคลเอ็นต์ Python
ทําตามวิธีการตั้งค่าและการให้สิทธิ์/การตรวจสอบสิทธิ์ในการเริ่มต้นใช้งาน API อย่างรวดเร็ว
หลังจากแทนที่ฟิลด์ต่อไปนี้ด้วยข้อมูลที่เกี่ยวข้องกับบัญชีแล้ว คุณจะเรียกใช้คําค้นหาด้านล่างเพื่อดึงรายงานการเข้าชมที่ไม่ถูกต้องสําหรับ Google Ads แคมเปญได้
- ไฟล์ข้อมูลลับไคลเอ็นต์
- รหัสลูกค้า
- คีย์ API
- Campaign IDs
- เขตเวลา
โค้ดตัวอย่าง
การเข้าชมที่ไม่ถูกต้อง
from __future__ import print_function
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',
discoveryServiceUrl='https://adsdatahub.googleapis.com/$discovery/rest?version=v1&labels=')
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',
'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))
เมตริกการมองเห็นโฆษณา
from __future__ import print_function
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',
discoveryServiceUrl='https://adsdatahub.googleapis.com/$discovery/rest?version=v1&labels=')
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)