Using an HTML Sprocket for Additional Ad Units (deprecated)


If you've switched to use Google's new GPT tags, follow instructions below to create your additional ad containers with HTML sprocket.

To confirm that you are using GPT tags, go to your DfP Ad Settings (as an Admin) via Admin > Settings > 3rd Party > DoubleClick for Publishers in your Metro Publisher work site.

If the field labeled "Publisher ID or Network code" looks something like this 1234567, then that is is the Google Network code which means that you are using GPT tags.In this case, use the instructions below to set up your additional ad units.

If the field labeled "Publisher ID or Network code" looks like this: ca-pub-123456789, then you are using GAM tags. In that case, you can follow these instructions to make ads: Using an HTML Sprocket for additional Ad Units (GAM only)

Part 1 - Create your Ad in DfP

  1. Log into your DFP account and go to Inventory
  2. Click "New Ad Unit" for Web
  3. Give it a name following the preferred naming convention
    • prefix with site short name like "MMP_"  (you can look yours up in Metro Publisher Settings)
    • name your ad unit with something that will help you recognize it in the future
    • Let's name it MMP_htmlsprocket_mpu
    • Keep this name handy!
  4. Select your size (recommend 300x250 or 300x600)
  5. Don't bother with Placements, just go ahead and save
  6. Insert artwork by placing an order
  7. Look up your Network ID (click the Admin tab) and keep it handy, too

Part 2b - Create an HTML Sprocket to display the ad

  1. While still inside DfP, click on the Inventory tab. Click to view the ad you just created. In this example, we named the new Ad Unit MMP_htmlsprocket_mpu.


  2. Click the "Generate tags" button to see the code. Click on the code in the second window and copy it.
  3. Go to Metro Publisher Sprockets area and add a new HTML Sprocket.
  4. In the Edit Sprocket window, in the HTML text editor, click "Source" and paste in the SOURCE code you just copied.
  5.  Now add this code above it.
    <script type='text/javascript'>
    googletag.cmd.push(function() { var slot_put_slot_name =
    googletag.defineSlot('/insert_network_ID/insert_slot_name', [300, 250], 'Google_slot_ID')
    googletag.pubads().enableSingleRequest(); googletag.enableServices(); });
  6. You'll notice that the code above has some placeholders. Replace the placeholders with the actual data.

    In this example, the actual data is:

    • Network ID = 1234567
    • slot_name = MMP_htmlsprocket_mpu
      - this is what you named it originally when you created it in DfP
    • Google_slot_ID  = div-gpt-ad-1367481406968-0
      - this unique ID comes from the code you copied previously and is generated each time you click "Generate tag"
  7. So, the final code you should have in your HTML sprocket is the following:

    <script type='text/javascript'>
    googletag.cmd.push(function() { var slot_put_slot_name =
    googletag.defineSlot('/1234567/MMP_htmlsprocket_mpu', [300, 250], 'div-gpt-ad-1367481406968-0')
    googletag.pubads().enableSingleRequest(); googletag.enableServices(); });
    </script> <!-- MMP_htmlsprocket_mpu -->
    <div id='div-gpt-ad-1367484519703-0' style='width:300px; height:250px;'>
    <script type='text/javascript'>
    googletag.cmd.push(function() { googletag.display('div-gpt-ad-1367484519703-0'); });
  8. Give your new Sprocket a title that will help you recognize it and click "Save".
  9. Now, you can go ahead and insert this Sprocket in any Homepage or Section/Subsection.
*You sometimes have to wait about 30 minutes before new ads start delivering in DfP
If you are using GAM tags, you can follow these instructions to make ads.
Have more questions? Submit a request


Powered by Zendesk