Creating TrueView Template Ad

552 views
Skip to first unread message

Richard Biffin

unread,
Jul 15, 2015, 9:40:34 AM7/15/15
to adwor...@googlegroups.com
Hi

Is anyone able to tell me whether creating an ad based on the TrueView ad template requires the video to be associated to the Adwords account??

I was just adding the templateElements fields array like below and the error is that the 'VIDEO' type field requires a field_media parameter which is a Media object you get from the MediaService, which we be any media associated to you Adwords account. I was hoping to not have to associate the videos to the Adwords account first

Using the Ruby client

Is this correct?

Thanks
Richard

fields: [
            {
              name: 'videoId',
              type: 'VIDEO',
              field_text: params[:video_id]
            },
            {
              name: 'imageUrl',
              type: 'URL',
              field_text: 'path to image'
            },
            {
              name: 'channelName',
              type: 'TEXT',
              field_text: 'a channel name'
            },
            {
              name: 'headline',
              type: 'TEXT',
              field_text: 'headline text'
            },
          ]






Anthony Madrigal

unread,
Jul 15, 2015, 12:38:28 PM7/15/15
to adwor...@googlegroups.com, rkj...@gmail.com
Hi Richard,

When creating video template ads, you will need to use a video that is uploaded through the AdWords UI (since it is not supported through API). You are required to do so since the media ID is used to create the video ad and is used to retrieve video ads through the MediaService.

Regards,
Anthony
AdWords API Team

Richard Biffin

unread,
Jul 15, 2015, 6:25:51 PM7/15/15
to adwor...@googlegroups.com, rkj...@gmail.com
Ok thanks for this. I was hoping to just link a YouTube video as the media, not have to upload the video again. I see that the MediaService has an upload function which currently only supports images, is there any plan to allow uploading of videos in the near future?

Thanks
Richard

Josh Radcliff (AdWords API Team)

unread,
Jul 16, 2015, 4:36:45 PM7/16/15
to adwor...@googlegroups.com, rkj...@gmail.com
Hi Richard,

It may be that the documentation on MediaService is outdated. Have you tried uploading your video via that service and it failed?

Also, are you looking to set up these ads for an AdWords for Video campaign or a regular AdWords campaign? I ask because the AdWords API does not currently support managing AdWords for Video campaigns.

Thanks,
Josh, AdWords API Team

Richard Biffin

unread,
Jul 16, 2015, 7:13:36 PM7/16/15
to adwor...@googlegroups.com, rkj...@gmail.com
Hi Josh, are you saying that video uploading is supported? I don't really want to upload I just want to link a YouTube video.

I haven't tried yet because not sure how to do it, with an image you can base64 encode and use the data property of the media object but according to the videos docs there is no data property. How do I tell the MediaService which video to upload or which YouTube video to use.

This is what I currently have but doesn't work and wouldn't really expect it to but not sure what else to try.

service = $api.service(:MediaService, $version)
    
video = {
    type: 'VIDEO',
    you_tube_video_id_string: params[:video_id],
}

service.upload([video])

This creates an UnexpectedParametersError: [:you_tube_video_id_string, :streaming_url])

I am looking to create just a regular Adwords campaign with the ad based on the TrueView template (template id 231). Based on the template docs all I need to do is give it a YouTube videoId and an optional videoThumbnail and destinationPage


but this doesn't work, if I leave out the field_media, it starts complaining about required field. So I add in field_media with appropriate properties but it requires a media_id which I can only get from the MediaService, either by uploading (which doesn't work for videos) or creating an ad through the web interface, selecting a YouTube video from the ad gallery TrueView template, in fact you don't have to create the ad, all you have to do is select the YouTube video when starting to create your ad, which looks like it essentially associates the YouTube video to the Adwords account, this video is then part of the MediaService .get collection via the API.

Thanks
Richard

Josh Radcliff (AdWords API Team)

unread,
Jul 17, 2015, 11:26:19 AM7/17/15
to adwor...@googlegroups.com, rkj...@gmail.com
Hi Richard,

I spoke with our resident MediaService expert, and here are the key points:
  1. The comment on MediaService.upload regarding images is correct. You can only upload images through the API. However, if you uploaded Audio or Video media objects through the user interface, you'll be able to retrieve them via MediaService.get and MediaService.query.
  2. When creating a TrueView template ad, you should specify the YouTube video ID for the videoId field (without the URL -- just the ID).
  3. We're not sure if linking your YouTube and AdWords accounts is required for the TrueView template. I'd recommend just giving it a try without linking to see if you encounter any issues.
Hope that helps!

Cheers,
Josh, AdWords API Team

Richard Biffin

unread,
Jul 19, 2015, 4:59:15 PM7/19/15
to adwor...@googlegroups.com, rkj...@gmail.com
Hi Josh

Thanks for the update. I have tried creating an ad based on the TrueView template using this code, so only using the video_id

template_ad = {
  name: 'Ad Name',
  display_url: 'youtube.com/channelname',
  final_urls: [
  ],
  xsi_type: 'TemplateAd',
  template_id: "231",
  template_elements: [
    {
      unique_name: "adData",
      fields: [
        {
          name: 'videoId',
          type: 'VIDEO',
          field_text: params[:video_id]
        },
        {
          name: 'imageUrl',
          type: 'URL',
          field_text: 'http://i.ytimg.com/vi/videoid/default.jpg'
        },
        {
          name: 'channelName',
          type: 'TEXT',
          field_text: 'channelName'
        },
        {
          name: 'headline',
          type: 'TEXT',
          field_text: 'Some Headline Text'
        }
      ]
    }
  ]
}

operation = {
  operator: 'ADD',
  operand: {
    ad_group_id: ad_group_id,
    ad: template_ad
  }
}

service = $api.service(:AdGroupAdService, $version)

ad = service.mutate([operation])


I get back the error

[AdError.EMPTY_FIELD @ operations[0].operand.ad.templateElements[0].fields[0].fieldMedia; trigger:'<null>'] 

So I guess the field_media is required, but obviously using the field media means I need to use the MediaService to query for the mediaId to include in the field_media. If I leave off the displayUrl, finalUrls I also get required field errors, the same if I leave off the imageUrl, headline and channelName, these are all required.

It seems to me to do with this

        {
          name: 'videoId',
          type: 'VIDEO',
          field_text: params[:video_id]
        },

The 'type' VIDEO requires the media_field to be included but this seems to treat it as an in-stream video ad, which requires a 'video' object parameter instead of the TrueView template ad which requires only the YouTube videoId. I am setting the template id to 231 which is the ID for the TrueView template.

I don't understand why this requires a MediaService object if we are already giving it the YouTube videoId.

Thanks
Richard

Josh Radcliff (AdWords API Team)

unread,
Jul 20, 2015, 12:57:01 PM7/20/15
to adwor...@googlegroups.com, rkj...@gmail.com
Hi Richard,

Might I suggest creating the ad through the AdWords user interface, then retrieving it via the API? The advantage to this approach is that we'll see precisely which fields of the template need to be populated, as well as how they are populated.

Thanks,
Josh, AdWords API Team

Richard Biffin

unread,
Jul 20, 2015, 6:05:58 PM7/20/15
to adwor...@googlegroups.com, rkj...@gmail.com
Hi Josh

I tried creating an ad based on the TrueView template within the Adwords web interface. I can select the YouTube video fill out the form but every time I try and save the ad the error pops up saying  "Please correct errors above"

These are the steps I use to produce this problem.

Login to Adwords using my test MCC account
Select one of my client account which I created
Create a Campaign of type "Search Network with Display Select" with "All Features" checked
Enter a daily budget (all other settings are default)
Create Campaign
Create an Ad Group with a default bid (all other settings are default)
On the Ad tab, click the  + Ad dropdown, select Ad Gallery
Select Video Ads
Select TrueView in-display video ad
Fill out the Ad form
Add Headline, Description
Select a YouTube video (Looks like you can select any YouTube video) At no point has it asked me to link my YouTube account.
I select a YouTube video that I know about
Select a thumbnail (it selects the first by default)
Give it a name
Hit Save
Get error message "Please fix above errors"

There are no errors to fix

Screens




I have tried this with a proper Adwords account also, same issue. So I can't query for a created ad via the API because it seems I can't even create one. This is all done via the standard Adwords interface (Online Campaigns not Video Campaigns)

Please advise, thanks
Richard

Josh Radcliff (AdWords API Team)

unread,
Jul 21, 2015, 1:46:07 PM7/21/15
to adwor...@googlegroups.com, rkj...@gmail.com
Hi Richard,

I was able to create one of these ads through the user interface on a Search Network with Display Select campaign, but not on a Display Network only campaign. Were you trying to do this on a Display Network only campaign, perhaps?

Regarding creating template ad ID 231 through the API, I've got good news and bad news. The bad news is that, as you suggested, you need a mediaId in order to create the ad, and the only way to do that (even for a YouTube video) is to create a template ad through the user interface that points to your YouTube video. After that, you can fetch the mediaId via MediaService.

The good news is that once you've created at least one template ad that uses your YouTube video, you can use the generated mediaId to create additional template ads through the API that use that video. You'll need to include the following fields:
  • displayUrl
  • finalUrls
  • templateId
  • templateElements
    • headline
    • description1
    • description2
    • videoId
      • type = VIDEO
      • fieldMedia
        • mediaId = the mediaId you retrieved via MediaService
    • imageUrl
    • channelName
  • name
Hope that helps!

Cheers,
Josh, AdWords API Team

Richard Biffin

unread,
Jul 21, 2015, 5:03:54 PM7/21/15
to AdWords API Forum
Hi Josh

Thanks for this. Are you able to tell me if this will become available in the future? Would be really handy to be able to do this without having to do one first via the web interface.

Richard

Josh Radcliff (AdWords API Team)

unread,
Jul 22, 2015, 11:10:54 AM7/22/15
to AdWords API Forum, rkj...@gmail.com
Hi Richard,

Unfortunately, I don't have an ETA for when or if this will be available, but I've passed your feedback along.

Thanks,
Josh, AdWords API Team

Ankit Jain

unread,
Sep 3, 2015, 12:32:02 PM9/3/15
to AdWords API Forum, rkj...@gmail.com
Any updates on creating "TrueView In stream youtube ad" through API? 

Josh Radcliff (AdWords API Team)

unread,
Sep 3, 2015, 2:58:58 PM9/3/15
to AdWords API Forum, rkj...@gmail.com
Hi,

Sorry, but I don't have an update at this time. For now, I'd recommend using the workaround I mentioned in my previous post.

Thanks,
Josh, AdWords API Team

Josh Radcliff (AdWords API Team)

unread,
Sep 21, 2015, 8:09:56 AM9/21/15
to AdWords API Forum, rkj...@gmail.com
Hi Ankit,

The template ads team has informed me that uploading YouTube videos through MediaService is not supported at this time. Therefore, the only option for the foreseeable future is to use the workaround I mentioned earlier.

Thanks,
Josh, AdWords API Team

Nick Brandes

unread,
Nov 20, 2015, 1:28:34 PM11/20/15
to AdWords API Forum, rkj...@gmail.com
Has anyone successfully used this template with Python? I have looked up the media id with mediaService, but am still getting the INVALID_MEDIA_TYPE error. If anyone could post the code you are using to create template 433 in Python it would be super helpful. 

This is the syntax I am trying to use:

ad_data = {
      'uniqueName': 'adData',
      'fields': [
          {
            'name': 'appStore',
            'fieldText': '1',
            'type': 'ENUM'
          },
          {
            'name': 'appId',
            'fieldText': '578830929',
            'type': 'TEXT'
          },
          {
            'name': 'headline',
            'fieldText': 'This is Headline',
            'type': 'TEXT'
          },
          {
            'name': 'description',
            'fieldText': 'This is Description',
            'type': 'TEXT'
          },
          {
            'name': 'skippableSeconds',
            'fieldText': '5',
            'type': 'NUMBER'
          },
          {
            'name': 'video',
            'fieldMedia': {
                'mediaId': video_media_id
            }
            'type': 'VIDEO'
          }
      ]
  }

This is the error I am getting: 

suds.WebFault: Server raised fault: '[MediaError.INVALID_MEDIA_TYPE @ operations[0].operand.ad.templateElements[0].fields[5].fieldMedia; trigger:'<null>']'

Josh Radcliff (AdWords API Team)

unread,
Nov 20, 2015, 3:35:26 PM11/20/15
to AdWords API Forum, rkj...@gmail.com
Hi,

Have you tried also putting 'type': 'VIDEO' inside the fieldMedia field?

Cheers,
Josh, AdWords API Team

Josh Radcliff (AdWords API Team)

unread,
Nov 20, 2015, 5:55:29 PM11/20/15
to AdWords API Forum, rkj...@gmail.com
Hi,

I just verified I can do this via the Java client library, and it looks like what may be missing is 'xsi_type': 'Video'. Below is the snippet of my XML containing the templateElements, in case that's helpful.

                        <templateElements>
                            <uniqueName>adData</uniqueName>
                            <fields>
                                <name>skippableSeconds</name>
                                <type>NUMBER</type>
                                <fieldText>1</fieldText>
                            </fields>
                            <fields>
                                <name>video</name>
                                <type>VIDEO</type>
                                <fieldMedia xsi:type="ns2:Video">
                                    <mediaId>1473888151</mediaId>
                                </fieldMedia>
                            </fields>
                            <fields>
                                <name>headline</name>
                                <type>TEXT</type>
                                <fieldText>Install my app</fieldText>
                            </fields>
                            <fields>
                                <name>description</name>
                                <type>TEXT</type>
                                <fieldText>App</fieldText>
                            </fields>
                            <fields>
                                <name>appId</name>
                                <type>TEXT</type>
                                <fieldText>578830929</fieldText>
                            </fields>
                            <fields>
                                <name>appStore</name>
                                <type>ENUM</type>
                                <fieldText>1</fieldText>
                            </fields>
                        </templateElements>

Cheers,
Josh, AdWords API Team

Nick Brandes

unread,
Nov 20, 2015, 6:55:16 PM11/20/15
to AdWords API Forum, rkj...@gmail.com
Thanks so much Josh. The script is now working. For anyone else who comes across this, the syntax I used is:

{
            'name': 'video',
            'fieldMedia': {
                'mediaId': '1112048128',
                'xsi_type': 'Video'
            },
            'type': 'VIDEO'

Tom Flower

unread,
Jun 22, 2016, 10:35:41 AM6/22/16
to AdWords API Forum
Hi Josh, 
Any word on if the MediaService is going to be updated to support video or if the  
TrueView in-search video ad template could be updated to accept a youtube link as used if created through the UI. 
Thanks.

Josh Radcliff (AdWords API Team)

unread,
Jun 22, 2016, 2:41:22 PM6/22/16
to AdWords API Forum
Hi,

Sorry, but I don't have any updates yet on this.

Thanks,
Josh, AdWords API Team

Rajesh Roushan

unread,
Aug 9, 2016, 8:04:31 AM8/9/16
to AdWords API Forum

Josh Radcliff (AdWords API Team)

unread,
Aug 9, 2016, 10:10:47 AM8/9/16
to AdWords API Forum
Hi,

The displayUrl must start with either youtube.com/channel/UC or youtube.com/user/. Please give that a try and post back here if it doesn't work out for you.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages