ภาพรวม
วิธีการด้านล่างแสดงตัวอย่างวิธีค้นหาทั้งการเข้าชมที่มีสิทธิ์แสดงผลและการเข้าชมที่ไม่ถูกต้องโดยใช้ API เมตริกเหล่านี้จํากัดไว้สําหรับพื้นที่โฆษณาที่ซื้อโดยใช้ Google Ads, Display & Video 360 และ YouTube Reserve
โปรดทราบว่าเมตริกการดู TrueView ที่ได้รับการรับรองจาก MRC ต้องใช้ ADH API เนื่องจากไม่มีคําค้นหาเทมเพลตที่เกี่ยวข้อง นอกจากนี้ โปรดอย่าสับสนระหว่างเมตริกยอดดู TrueView กับเมตริกการมองเห็นโฆษณา
เลือกช่องทางการซื้อที่ต้องการค้นหาเมตริกการแสดงผล
ค้นหาเมตริกการมองเห็นโฆษณาโดยใช้ UI
การค้นหาความสามารถในการมองเห็นโฆษณาที่ใช้เทมเพลตจะให้เมตริกที่ผ่านการรับรองจาก MRC
การรับรองของ MRC เป็นแบบ 2 ค่า คือผลการค้นหาอาจได้รับการรับรองหรือไม่ได้รับการรับรองก็ได้ และจะมีผลกับตารางผลลัพธ์ทั้งหมด ใน BigQuery ระบบจะใช้ป้ายกํากับ adh-mrc-accredited
กับผลการค้นหาทั้งหมดที่ได้รับการรับรองจาก MRC คุณต้องเรียกใช้การค้นหาผ่านเทมเพลตเพื่อให้เมตริกได้รับการรับรองจาก MRC
วิธีเรียกใช้การค้นหาที่ MRC รับรองผ่านเทมเพลต
- ทําตามวิธีการเกี่ยวกับวิธีสร้างคําค้นหา โดยเลือก YouTube Reserve เป็นช่องทางการซื้อและการมองเห็นวิดีโอ เป็นเทมเพลตคําค้นหา
- คลิกปุ่มเรียกใช้ข้างใช้เทมเพลต
ค้นหาเมตริกการเข้าชมที่ไม่ถูกต้องและเมตริกการแสดงผลโดยใช้ API
คุณดึงข้อมูลเมตริกการเข้าชมและการมองเห็นโฆษณาที่ไม่ถูกต้องได้จาก ADH API โดยใช้ปลายทาง generateIvtReport
และ startAnalysis
สําหรับการเข้าชมที่ไม่ถูกต้อง คุณต้องดึงข้อมูลเมตริกผ่าน generateIvtReport
เพื่อให้ระบบใช้adh-mrc-accredited
ป้ายกํากับและรับรองเมตริกของคุณโดย MRC ในทํานองเดียวกัน ต้องใช้การค้นหาแบบรวมที่ระบุไว้ด้านล่างสําหรับเมตริกการมองเห็นโฆษณาผ่าน ADH API เพื่อการรับรอง MRC ส่วนนี้จะอธิบายวิธีส่งคําขอไปยังปลายทางนี้โดยใช้ไลบรารีไคลเอ็นต์ Python
ทําตามวิธีการตั้งค่าและการให้สิทธิ์/การตรวจสอบสิทธิ์ในการเริ่มต้นใช้งาน API อย่างรวดเร็ว
หลังจากแทนที่ช่องต่อไปนี้ด้วยข้อมูลที่เกี่ยวข้องกับบัญชีแล้ว ให้เรียกใช้การค้นหาด้านล่างเพื่อเรียกข้อมูลรายงานการเข้าชมที่ไม่ถูกต้องสําหรับ YouTube Reserve แคมเปญ
- ไฟล์รหัสลับไคลเอ็นต์
- รหัสลูกค้า
- คีย์ API
- Order 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',
'yt_reserve_dimensions': {
'order_ids': [YOUR_ORDER_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/ad88e8562a8f4baa9c8522945fe95522'
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': {
'line_item_ids': {
'array_value': {
'values': [
{
'value': 'YOUR_LINE_ITEM_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 สุทธิ)