What should be the final URL and display URL to create TrueView in-search video ad

48 views
Skip to first unread message

Rajesh Roushan

unread,
Jul 24, 2016, 10:30:00 PM7/24/16
to AdWords API Forum

I am trying to create TrueView in-search video ad using adwords api with code as below and it does not accept display URL, i tried with different combination of display URL but error is still the same. Here is the code 


     TemplateAd videoAd = new TemplateAd();

videoAd.setName("vidoolyVideoAd");

videoAd.setTemplateId(231l);

videoAd.setFinalUrls(new String[] {"https://youtu.be/jbGkBDIMBW4"});

videoAd.setDisplayUrl("www.vidooly.com");

TemplateElementField headline = new TemplateElementField();

headline.setName("headline");

headline.setType(TemplateElementFieldType.TEXT);

headline.setFieldText("kuchViBol");

TemplateElementField videoId = new TemplateElementField();

videoId.setName("videoId");

videoId.setType(TemplateElementFieldType.VIDEO);

videoId.setFieldText("https://youtu.be/jbGkBDIMBW4");

TemplateElementField channelName = new TemplateElementField();

channelName.setName("channelName");

channelName.setType(TemplateElementFieldType.TEXT);

channelName.setFieldText("youtube.com/Google");

TemplateElementField imageUrl = new TemplateElementField();

imageUrl.setName("imageUrl");

imageUrl.setType(TemplateElementFieldType.URL);

imageUrl.setFieldText("http://vidooly.com/resources/v1/images/vidooly-yt-logo.png");

TemplateElement adData = new TemplateElement();

        adData.setUniqueName("adData");

        adData.setFields(new TemplateElementField[] {headline, videoId,imageUrl});

        

        videoAd.setTemplateElements(new TemplateElement[] {adData});

        

        AdGroupAd html5AdGroupAd = new AdGroupAd();

        html5AdGroupAd.setAdGroupId(28619480966l);

        html5AdGroupAd.setAd(videoAd);


        // Optional: Set the status.

        html5AdGroupAd.setStatus(AdGroupAdStatus.PAUSED);


        // Create the operation.

        AdGroupAdOperation operation = new AdGroupAdOperation();

        operation.setOperator(Operator.ADD);

        operation.setOperand(html5AdGroupAd);

        

        AdGroupAdReturnValue result = adGroupAdService.mutate(new AdGroupAdOperation[] {operation});



followings is the error code [AdError.INVALID_YOUTUBE_DISPLAY_URL @ operations[0].operand.ad.displayUrl 

Joyce Lava

unread,
Jul 25, 2016, 5:50:37 AM7/25/16
to AdWords API Forum
Hi Rajesh,

For creating template ad ID = 231, you first need to create it through the AdWords UI. Please refer to this article on how to do so. After creating the template ad in AdWords UI, you need to get the mediaId using MediaService.get. The mediaId will then be used for the videoId to create the template ad using the AdWords API.  Please refer to the previous forum discussion regarding this.

Additionally, the finalURLs are the list of possible final URLs that the users may see in the browser after clicking an ad. While the displayURL is the visible URL in an ad.

Hope this helps.

Best Regards,
Joyce, AdWords API Team
Reply all
Reply to author
Forward
0 new messages