需求開發廣告贏得廣告競價後,就會向使用者放送廣告素材。
AdGroupAd 資源,在聯集欄位 ad_details 下方設定相關廣告素材選項。
設定廣告詳細資料
需求開發廣告有四種類型。每個 AdGroupAd 資源只能是單一類型。每種型別都會在聯集欄位 ad_details 下的個別欄位中設定:
每個欄位的說明中都有相關廣告類型規定的連結。建立 AdGroupAd 資源時,只能填入其中一個欄位。
各類型圖片的尺寸和解析度規定
每種廣告類型都需要不同大小的圖片素材資源。
下表列出圖片類型和相關檔案限制:
| 映像檔類型 | |
|---|---|
| 隨播橫幅廣告 |
檔案大小上限:150 KB 尺寸:300x60 |
| 橫向圖片 |
檔案大小上限:5120 KB 建議尺寸:1200x628,最小尺寸:600x314 |
| 標誌圖像 |
檔案大小上限:5120 KB 建議尺寸:1200x1200,最小:128x128 |
| 直向圖片 |
檔案大小上限:5120 KB 建議尺寸:960x1200,最小尺寸:480x600 |
| 正方形圖片 |
檔案大小上限:5120 KB 建議尺寸:1200x1200,最小尺寸:300x300 |
製作廣告
如要製作需求開發影片廣告,請按照下列步驟操作:
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.")