Test on a small screen
GPT requires a screen of at least 1200 by 650 pixels. In smaller windows, the ad does not appear.
Implementation guide
Side rail ads
An ad pinned to the left or right side of the screen on wide desktop screens, in the empty space next to the content.
Understand it in 1 minute
A side rail ad sticks to the left or right side of the screen, in the empty space left beside the text. Picture a classroom with a bulletin board on the side wall: students look at the board in front, and the bulletin board just stays there without getting in the way. The side rail is that bulletin board. The person scrolls the page and the ad stays in the same place.
It is made for wide screens, like computers. Many sites have the text in the middle and two empty strips on the sides, and the side rail uses that space without pushing or covering the content. In AdSense, it is part of Auto ads, in the overlay formats group, under the name Side rail ads. You turn it on with one click and choose left and right, left only, or right only.
In Ad Manager, the side rail is shown by GPT, the Google Publisher Tag, which is the Google code that requests ads. You create a slot, which is the ad space, of the left or right side rail type. GPT itself creates the little ad box and places it near the content, between 5 and 25 pixels away. If the window gets smaller and the space disappears, the ad hides until the space comes back.
It is worth it when your site has plenty of free space on the sides on large screens. GPT requires a screen of at least 1200 by 650 pixels and an empty space of at least 120 by 500 pixels beside the content. If your layout fills the screen edge to edge, there is no room left and the ad simply does not appear.
Step by step
Implemented example
<!-- AdSense: parte da página onde a barra lateral não deve sobrepor -->
<div google-side-rail-overlap="false">
... conteúdo ...
</div>
<!-- Ad Manager (GPT), no head -->
<script async
src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"
crossorigin="anonymous"></script>
<script>
window.googletag = window.googletag || { cmd: [] };
googletag.cmd.push(() => {
const leftSideRail = googletag.defineOutOfPageSlot(
"/1234567/exemplo",
googletag.enums.OutOfPageFormat.LEFT_SIDE_RAIL,
);
const rightSideRail = googletag.defineOutOfPageSlot(
"/1234567/exemplo",
googletag.enums.OutOfPageFormat.RIGHT_SIDE_RAIL,
);
// Volta null se a página ou o aparelho não aceitar barra lateral
if (leftSideRail) leftSideRail.addService(googletag.pubads());
if (rightSideRail) rightSideRail.addService(googletag.pubads());
googletag.enableServices();
if (leftSideRail) googletag.display(leftSideRail);
if (rightSideRail) googletag.display(rightSideRail);
});
</script>
<!-- Teste: acrescente no fim do endereço da página -->
<!-- #gamLeftSideRailDemo ou #gamRightSideRailDemo -->What Google recommends
Tips
Watch out
GPT requires a screen of at least 1200 by 650 pixels. In smaller windows, the ad does not appear.
If the content takes up the full width, the empty 120 by 500 pixel space is not left and the side rail has nowhere to go.
GPT returns null when the page or the device does not support a side rail. Your code needs to check this before using the slot.
In AdSense, the code must be on every page for Auto ads to work.
No. In AdSense it is for desktop only, and in Ad Manager it is a desktop format that needs a wide screen.
No. The side rail creates its own little box and places it as close to the content as possible.
Yes. In AdSense there are the left only and right only options, and in GPT you can define only the slot for the side you want.
In Ad Manager, the slot sits between 5 and 25 pixels from the main content.
Library
Everything on this page follows Google's official documentation. Read it straight from the source:
The audit reads the site as a visitor would, without clicking anything, and shows what to fix.