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
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).
YouTube does not show in-stream ads by default. You must explicitly enable them in the ad policy, using the <instream> tag, and must specify the break times when the ads should run.
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
InVideo ads
InVideo Ads have the following components:
- A transparent 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 overlay, the companion ad, or both. If an 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
AdSense ads can be overlay ads, 300px by 250px image display ads, or text ads displayed in a 300px by 250px area. In addition, the overlay ads themselves could also be text or image 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 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 image or text ads in the space to the right of the video player.
The following examples show different types of ad policies:
- 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/>
<video_breaks video="/external/video[@id='VIDEO_ID_1_']">
<break time="0"/>
<break time="-1"/>
- 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
<video_breaks video="/external/video[@id='VIDEO_ID_1_']">
<break time="0"/>
<break time="00:06:12"/>
<break time="00:11:25"/>
<break time="00:20:37"/>
<break time="-1"/>
* Nguồn: Youtube