Back in 2007, we first introduced support for video ads (Click-to-Play Video) in the AdWords API. This required a dedicated VideoAd type, which made it less adaptive to future video formats. The AdWords API has significantly improved since then with more flexible support for handling various ad types.
Video ads in the API are now supported through a new type, the TemplateAd. Template ads allow for an easy way to introduce new ad types, defined through template ad formats, without having to add new ad types. In turn, this makes it possible to release new ad features and updates much faster without waiting for the next version of the API.
Before a video ad can be created, the campaign must be set to show ads on the content network. As in previous versions, the video itself must be uploaded to your account via the web interface (see instructions). Once your video is uploaded, it is assigned a media ID, one of the elements required to create a video ad, which can be retrieved through the MediaService’s get() method. Now you have everything you need to create a video ad via the AdGroupAdService using the Click-to-Play Video template ad format. The client libraries have examples for retrieving a media ID and creating video
operations = [
{
'operator': 'ADD',
'operand': {
'type': 'AdGroupAd',
'adGroupId': ad_group_id,
'ad': {
'type': 'TemplateAd',
'templateId': '9',
'templateElements': [{
'uniqueName': 'adData',
'fields': [
{
'name': 'startImage',
'type': 'IMAGE',
'fieldMedia': {
'mediaTypeDb': 'IMAGE',
'name': 'Starting Image',
'data': image_data
}
},
{
'name': 'displayUrlColor',
'type': 'ENUM',
'fieldText': '#ffffff'
},
{
'name': 'video',
'type': 'VIDEO',
'fieldMedia': {
'mediaId': video_media_id,
'mediaTypeDb': 'VIDEO'
}
}
]
}],
'dimensions': {
'width': '300',
'height': '250'
},
'name': 'VideoAdTemplateExample',
'url': 'http://www.example.com',
'displayUrl': 'www.example.com'
}
}
}
]
ads = ad_group_ad_service.Mutate(operations)
-- Stan Grinberg, AdWords API Team