สร้างโฆษณา Demand Gen

โฆษณา Demand Gen จะสร้างครีเอทีฟโฆษณาที่แสดงต่อผู้ใช้เมื่อชนะการประมูลเพื่อแสดงโฆษณา แหล่งข้อมูล AdGroupAd จะกำหนดค่าตัวเลือกครีเอทีฟโฆษณาที่เกี่ยวข้องภายใต้ ฟิลด์สหภาพ ad_details

กำหนดค่ารายละเอียดโฆษณา

โฆษณา Demand Gen มี 4 ประเภท ทรัพยากร AdGroupAd แต่ละรายการจะเป็นได้เพียงประเภทเดียว โดยจะกำหนดค่าแต่ละประเภทในฟิลด์แต่ละรายการภายใต้ฟิลด์รวม ad_details ดังนี้

ลิงก์ไปยังข้อกำหนดของประเภทโฆษณาที่เกี่ยวข้องอยู่ในคำอธิบายของ แต่ละฟิลด์ คุณจะป้อนข้อมูลในช่องเหล่านี้ได้เพียงช่องเดียวเมื่อสร้างทรัพยากร AdGroupAd

ข้อกำหนดด้านขนาดและความละเอียดของรูปภาพตามประเภท

โฆษณาแต่ละประเภทต้องใช้ชิ้นงานรูปภาพขนาดต่างๆ

ตารางต่อไปนี้แสดงประเภทรูปภาพและข้อจำกัดของไฟล์ที่เกี่ยวข้อง

ประเภทรูปภาพ
แบนเนอร์ที่แสดงร่วมกัน

ขนาดไฟล์สูงสุด: 150 KB

ขนาด: 300x60

รูปภาพแนวนอน

ขนาดไฟล์สูงสุด: 5120 KB

ขนาดที่แนะนำ: 1200x628, ขั้นต่ำ: 600x314

รูปภาพโลโก้

ขนาดไฟล์สูงสุด: 5120 KB

ขนาดที่แนะนำ: 1200x1200, ขั้นต่ำ: 128x128

รูปภาพแนวตั้ง

ขนาดไฟล์สูงสุด: 5120 KB

ขนาดที่แนะนำ: 960x1200, ขั้นต่ำ: 480x600

รูปภาพสี่เหลี่ยมจัตุรัส

ขนาดไฟล์สูงสุด: 5120 KB

ขนาดที่แนะนํา: 1200x1200, ขั้นต่ำ: 300x300

สร้างโฆษณา

วิธีสร้างโฆษณาวิดีโอ Demand Gen มีดังนี้

Python

# Provide the ID of the parent advertiser.
advertiser_id = advertiser-id

# Provide the ID of the parent line item.
ad_group_id = ad-group-id

# Provide the display name of the ad.
display_name = display-name

# Provide the information for the ad creative.
final_ad_url = final-ad-url
call_to_action = call-to-action
headline = headline
long_headline = long-headline
description = description
business_name = business-name
youtube_asset_id = youtube-video-asset-id
logo_asset_id = logo-asset-id

# Create an ad object with example values.
ad_obj = {
    "adGroupId": ad_group_id,
    "displayName": display_name,
    "entityStatus": "ENTITY_STATUS_PAUSED",
    "demandGenVideoAd": {
        "finalUrl": final_ad_url,
        "callToAction": call_to_action,
        "headlines": [headline],
        "longHeadlines": [long_headline],
        "descriptions": [description],
        "businessName": business_name,
        "videos": [{"videoAssetId": youtube_asset_id}],
        "logo": {"assetId": logo_asset_id}
    }
}

# Build and execute request.
response = (
    service.advertisers()
    .adGroupAds()
    .create(advertiserId=advertiser_id, body=ad_obj)
    .execute()
)

# Display the new ad.
print(f"Demand Gen ad {response['name']} was created.")