Define advertising policies
You use the <ad_policy> tag to specify which types of ads YouTube can show during a video or on a channel page or video watch page. As with ownership and rights policy tags, you can apply the same ad policy to as many videos as you like.
The subtags of <ad_policy> identify the permitted advertising formats:
In-stream ads play within the video player and are the only content displayed in the player while they are playing. In that sense, they are analogous to television commercials. In-stream ads can play either before a video (pre-roll), during a video at designated times (mid-roll), or at the end of a video (post-roll).
You also specify whether a video shows TrueView in-stream ads or standard in-stream ads. (Note that your partner account must be configured to allow you to show each type of in-stream ad.) YouTube allows both types of ads by default. If your partner account is configured to show both standard and TrueView in-stream ads, both of those types will be eligible to run unless you use the <instream> tag's attributes to disable a particular type of in-stream ad from displaying.
Overlay ads occupy the bottom 20 percent of the video player. (In the standard 640px by 360px player, the overlay is 640px by 72px.) The video that the user is watching continues playing while the overlay displays. Overlay ad settings also govern YouTube's ability to show ads in a 300px by 250px companion ad slot that displays to the right of the video player.
The list below explains the types of overlay ads that YouTube supports. By default, YouTube does show overlay ads for a video. Thus, you would need to use an ad policy to explicitly disallow the use of such ads.
InVideo Ads have the following components:
- A transparent Flash overlay can occupy the bottom 20 percent of the video player.
- A 300px by 250px companion ad can display to the right of the video player.
If you enable a video to show InVideo Ads, then the video could show either the Flash overlay or the companion ad or both. If a Flash overlay and a companion ad both display, then both ads will be from the same campaign.
When a user clicks on either an InVideo overlay or companion ad, one of the following actions will occur:
- Another YouTube video will open and play inside the player. For some advertising campaigns, the other YouTube video will play automatically as a post-roll ad after the main video has ended.
- A new browser window will open the advertiser's website.
AdSense ads can be overlay ads, 300px by 250px Flash or image display ads, or text ads displayed in a 300px by 250px area. In addition, the overlay ads themselves could also be text, image or Flash ads.
If you enable AdSense overlay ads for a video, then Youtube handles the 300px by 250px ad slot differently depending on whether the video is playing on a channel page or a video watch page:
- When the video plays on a channel page, the page could also display an AdSense for Content (AFC) Flash or image ad to the right of the channel's video player.
- When the video plays on its video watch page, the page could also display AFC Flash, image or text ads in the space to the right of the video player.
The following examples show different types of ad policies:
Example 1: Enabling pre-roll and post-roll ads – This example shows how to enable pre-roll and post-roll instream ads.
<ad_policy video="/external/video[@id='VIDEO_ID_1_']"> <instream/> </ad_policy> <video_breaks video="/external/video[@id='VIDEO_ID_1_']"> <break time="0"/> <!-- Enables pre-roll ads --> <break time="-1"/> <!-- Enables post-roll ads --> </video_breaks>
Example 2: Enabling in-stream ads and disabling AdSense overlay ads – This example shows how to enable in-stream ads while disabling AdSense overlay ads.
<ad_policy video="/external/video[@id='VIDEO_ID_1_']"> <instream/> <overlay> <adsense_for_video>Deny</adsense_for_video> </overlay> </ad_policy> <video_breaks video="/external/video[@id='VIDEO_ID_1_']"> <break time="0"/> <!-- Enables pre-roll ads --> <break time="00:06:12"/> <break time="00:11:25"/> <break time="00:20:37"/> <break time="-1"/> <!-- Enables post-roll ads --> </video_breaks>