Serving ads on your partner's website

If you want ads from your network to serve on your partner's website, you can send Google Publisher Tags (GPT tags) to the other publisher so they can traffic them as third-party ads on their ad server.

To serve ads on your partner's website:

  1. Ask your webmaster to create the GPT tag as a single script block. All of the JavaScript code must be contained within a single <script> tag. Use the following code as a template:

    <script src="//www.googletagservices.com/tag/js/gpt.js">
       googletag.pubads().definePassback('/network_ID/first_level_ad_unit/second_level_ad_unit', [468, 60]).display();
    </script>
    

    The above example code snippet adds page-level custom targeting, not ad slot-specific custom targeting. The same targeting criteria will be set for all ad tags on the page.

  2. Send the tag to your partner.

Add click tracking to the tag

If your partner wants to add click tracking to the GPT tag, they'll need to add a clickthrough URL macro to the .definePassback call. The clickthrough URL will be dynamically prepended to the clickthrough URL stored on the DFP ad server.

<script src="//www.googletagservices.com/tag/js/gpt.js">
   googletag.pubads().definePassback(
      '/network_ID/first_level_ad_unit/second_level_ad_unit', [468, 60])
      .setClickUrl("%%CLICK_URL_UNESC%%")
      .display();
</script>

Add custom targeting

To add custom targeting to the GPT tag, call .setTargeting:

<script src="//www.googletagservices.com/tag/js/gpt.js">
   googletag.pubads().definePassback('/123456/passback/sports', [468, 60])
      .setTargeting("color", "red")
      .setTargeting("sport", ["rugby", "rowing"])
      .display();
</script>

If your partner uses legacy DART DFP

If your passback partner is using the legacy DFP platform or another that treats the '/' character as a relative path, please remove that character from the defineSlot line before sending the tag:

googletag.defineSlot("12345/adunit", [728, 90], "div-gpt-ad-123456789-0");