Google Ad Manager (GAM) Ad Sprocket


NOTE: This sprocket ONLY works with Google Ad Manager and the v4.0 Layout Section Editor. If you are an existing Metro Publisher client and have not updated your section pages within the last two years, you will need to update before you can use these Ad Sprockets.

If you are trying to insert ad code from another service such as Google AdSense, please use an HTML Sprocket.


With the Ad Sprocket for Google Ad Manager (GAM), you can easily insert custom ad units throughout your section landing pages and within content. The Ad Sprocket has two common mappings for the default ad unit sizes from Metro Publisher's responsive ad integration with GAM:

  1. 970x90 leaderboard* – This is a responsive ad slot with  several creative sizes for various mobile break points – 970x90(desktop), 728x90(tablet), and 300x50(mobile).
  2. 300x250 medium rectangle (mpu)* – This ad unit by default takes 300x250 or 300x600. It has no default responsive behaviors because it fits nicely at all screen sizes. 

  3. 160x600 Wallpaper – This a deprecated ad size that is no longer commonly in use. 

Read more about responsive ads...

 *For advanced users, there is also an option to create custom mappings (define creative sizes for different screens). Users can edit existing and create  additional mappings.


1. Getting Started 

The first step is to decide what type of ad you want to insert into your page. For my example, I am going to insert a medium rectangle (MPU) ad into the right rail.

Above, you'll see that I set up a section page with a 2/3 - 1/3 layout. On the right, I have an empty container. That is where I want to put my ad. In this space, the medium rectangle (300x250) is the only ad that will fit. 



2. Create a New Ad Unit in GAM

Now that you know what size ad you want, you must create the ad unit first in GAM

  1. Create a new ad unit in GAM and name it something indicative of how you will use it or where it goes on your site. Try to be as general as you can so you can re-use the same ad unit in different parts of your website. It is also a good idea to name them sequentially, as you may have more than one on a page.

  2. Add the size to your unit. In this case, the mpu is 300x250.

  3. Copy the Ad Unit Code. In this case, it is "MP-Custom-MPU-01." You will use this when you create your sprocket.



3. Create a New Ad Sprocket in Metro Publisher

Now that you've created a new ad unit in GAM, you'll create the ad sprocket in Metro Publisher and connect GAM to it with your Ad Unit Code.

  1. Go back to the section edit page and click "Add Sprocket"
  2. Select the "Ad Unit" Sprocket.
  3. Select the Size Mapping. In this case, "mpu_mapping"
  4. Give the sprocket a title. It is a good idea to use the Ad Unit Code as your title.
  5. Hit save.

Once that is done, your section page will contain the ad unit like this:





Using the Responsive Leaderboard

To insert the responsive leaderboard, the process is the same. The only exception is that, since the sprocket is responsive, you must enter in all three creative sizes when you create the ad slot.


Creative sizes for leaderboard ad:

  • 970x90
  • 728x90
  • 300x50



Adding Custom Mapping

NOTE: This is an advanced feature that requires some experience with different coding languages.

In order to create custom size mappings you will need to use DFP's special syntax for defining the the browser viewport size and the subsequent creative that should be served at that size.

As an example, here is the size mapping for a 970px leaderboard that has three breakpoints and three ad unit sizes: 



   [[0, 0], [300, 50]],

   [[750, 200], [728, 90]],

   [[1050, 200], [[970, 90]]



From a viewport size of 1050px and up, DFP will serve a 970x90 creative. From 750px to 1049px, DFP will serve a 728x90. And at any size smaller than 750px, a 300x50 ad unit will be served.


Below, is the same mapping but with a variation:



   [[0, 0], [300, 50]],

   [[750, 200], [728, 90]],

   [[1050, 250], [[970, 90], [970, 250]]]



In this example, there are two sizes possible at 1050px or above (desktop). Here DFP will look for either a 970x90 or a 970x250 creative. In this case, the ad trafficker has the option to add either creative size at that breakpoint



Have more questions? Submit a request


  • Avatar
    Karen Tappenden

    You never showed us how to add the leaderboard ads to the page as a sproket

  • Avatar
    Metro Publisher Support Squad

    The leaderboard is the same as the example with the MPU. The only difference is that:

    1. Select the leaderboard size mapping from the pulldown when you create the ad sprocket.

    2. You must add the three creative sizes for the responsive behavior when you create the new ad slot in DFP:

    - 970x90
    - 728x90
    - 300x50

  • Avatar
    Karen Tappenden

    But where do you put the sprocket?

  • Avatar
    Michael Romano

    You put it into your section pages using the new section editor like you would any sprocket. Since it is a leaderboard, you need to put it in as a full width sprocket. Here are some examples of leaderboards.

    As you scroll down the page in both cases, you'll see leaderboard ads inserted full-width every so often down the page.

  • Avatar
    Daniel O'Connor

    When creating the leaderboard sprocket how do you line this up centrally? At the moment they are aligning left on our dummy pages.

  • Avatar
    Metro Publisher Support Squad

    Please try submitting your question via support. And please also include a link to the page or the sprocket you are talking about.

    Thank you.

Powered by Zendesk