Open workspace

Implementation guide

Side rail ad

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.

  • AdSense
  • Ad Manager
  • desktop only
Desktop
Mobile

Understand it in 1 minute

What a side rail ad is

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

How to implement

  1. Put the code on every pageThe AdSense code must be on every page. After you turn it on, the ads can take up to an hour to appear.
  2. Turn it on in AdSenseClick Ads, then Edit next to the site. Turn on Auto ads and, under Overlay formats, check Side rail ads. Click Apply to site and choose Apply now or Run experiment first.
  3. Choose the sideIn the advanced settings, use Select side rail ad position: Left and right, Left only or Right only.
  4. In Ad Manager, create the slots in the headIn GPT, define out-of-page slots of the left side rail and right side rail types. Check that each one did not come back empty before you use it.
  5. Use the right sizesFor reservations and programmatic, the side rail sizes on desktop are 180x500, 160x600 and 120x600.
  6. Test with the demoAdd the demo code shown in the example to the end of the page address to see a test side rail without changing your code.

Implemented example

The code and how it looks on screen

The AdSense attribute goes on the element that wraps the part of the page to protect; the GPT block goes in the head for those who use Ad Manager.
<!-- 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 -->
On desktopOn a computer, the ad appears in a fixed column next to the content, on the left, on the right or on both sides, and stays visible while the person scrolls the page.
On mobileIt does not exist on mobile.

What Google recommends

Do and don't

Allowed

  • Choose left and right, left only or right only in AdSense.
  • Protect part of the page with the official attribute, so the side rail does not appear over that section.
  • Test first with an experiment on 50% of traffic for up to 90 days.
  • In Ad Manager, sell the side rail in reservations and programmatic, with sizes 180x500, 160x600 and 120x600.
  • Measure the result in AdSense with a custom report, filtering Ad format by Side rail ads.

Not allowed

  • Do not request a side rail on pages where you do not want it to appear.
  • Do not run GPT inside an iframe: the side rail needs GPT in the main window.
  • Do not fill all the space on the sides with other elements if you want this ad: without at least 120 by 500 empty pixels, it does not appear.
  • Do not place links, menus or download buttons right next to the ads: Google warns that this can cause accidental clicks.
  • Do not change the AdSense code beyond the modifications Google accepts, and do not encourage clicks on the ad.

Tips

To do it right

Watch out

Common errors

Test on a small screen

GPT requires a screen of at least 1200 by 650 pixels. In smaller windows, the ad does not appear.

Edge-to-edge layout

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.

Not checking whether the slot came back empty

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.

Code on only some pages

In AdSense, the code must be on every page for Auto ads to work.

Frequently asked questions

Does the side rail appear on mobile?

No. In AdSense it is for desktop only, and in Ad Manager it is a desktop format that needs a wide screen.

Do I need to create a div for it in GPT?

No. The side rail creates its own little box and places it as close to the content as possible.

Can I use just one side?

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.

What is the distance between the ad and the content?

In Ad Manager, the slot sits between 5 and 25 pixels from the main content.

Library

Official Google source

Everything on this page follows Google's official documentation. Read it straight from the source:

Does your site use this format the right way?

The audit reads the site as a visitor would, without clicking anything, and shows what to fix.

Run an audit