制作需求开发广告

需求开发广告系列广告会构建在赢得广告竞价时向用户投放的广告素材。 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.")