Help improve the Google Publisher Tag developer experience. Share your thoughts in our survey.

Passback tags

The Google Publisher Tag (GPT) library allows you to generate ad tags with “passback” functionality. These tags can be used in any situation where an ad request to a third party should ultimately be filled by an ad trafficked in your own Google Ad Manager network.

Use cases

Traffic remnant or fallback line items

Passback tags can be used when a third-party server doesn't have an ad to serve or when an ad doesn't meet the minimum CPM/floor price agreed upon with the third party. In these cases, the third-party server instead serves a GPT passback tag, which returns a house ad or other remnant ad from your own Ad Manager network.

Serve ads on another publisher's website

Passback tags can be used to serve ads from your Ad Manager network on another publisher's website. In these cases, the GPT passback tag would be trafficked by the other publisher and would return an ad from your own Ad Manager network.

Serve video ads

To create video passbacks, use a standard video tag to pass back from a third party to Ad Manager.

You can build this tag manually or using the Ad Manager video tag generator.

Construct passback tags

Passback tags can be constructed using the same API used to construct normal GPT ad tags. However, passback tags must be rendered inside an iframe to prevent them from inheriting page-level settings from any other GPT instance active on the publisher's website.

A basic example passback tag is shown below. Remember that this fragment is intended to be rendered inside an iframe. To see this in practice, you can try a live demo of this example on Glitch.

<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<div id="gpt-passback">
  <script>
    window.googletag = window.googletag || {cmd: []};
    googletag.cmd.push(function() {
        googletag.defineSlot('/6355419/Travel/Europe', [728, 90], 'gpt-passback')
          .addService(googletag.pubads());
        googletag.enableServices();
        googletag.display('gpt-passback');
    });
  </script>
</div>

Configure passback tags

Passback tags support the normal range of features available to GPT tags, such as those covered in the key-value targeting guide and code samples. Features which are unique to passback tags or which require special configuration when used in a passback context are explained below.

Enable click tracking

To add click tracking to a passback tag, a clickthrough URL macro can be appended to the tag as in the example below. The clickthrough URL will be dynamically prepended to the clickthrough URL stored on the Ad Manager ad server.

<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<div id="gpt-passback">
  <script>
    window.googletag = window.googletag || {cmd: []};
    googletag.cmd.push(function() {
        googletag.defineSlot('/6355419/Travel/Europe', [728, 90], 'gpt-passback')
          .addService(googletag.pubads())
          .setClickUrl('%%CLICK_URL_UNESC%%');
        googletag.enableServices();
        googletag.display('gpt-passback');
    });
  </script>
</div>

Inherit privacy settings

Since passback tags are rendered in an iframe, they do not automatically inherit privacy settings configured at the page-level. When passbacks are being used to serve an ad from one Ad Manager publisher to another, the TFCD macro can be used to include the current page-level child-directed treatment setting in the passback ad request.

<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<div id="gpt-passback">
  <script>
    window.googletag = window.googletag || {cmd: []};
    googletag.cmd.push(function() {
        googletag.defineSlot('/6355419/Travel/Europe', [728, 90], 'gpt-passback')
          .addService(googletag.pubads())
        googletag.pubads()
          .setPrivacySettings({childDirectedTreatment: Boolean('%%TFCD%%')});
        googletag.enableServices();
        googletag.display('gpt-passback');
    });
  </script>
</div>

Specify page URL

Since passback tags are rendered in an iframe, GPT may not be able to determine the URL of the page on which the tag is being served. If you are using Ad Exchange or AdSense to fill passback impressions, these systems can't send contextual information about the page to buyers without a page URL. This can lead to lower fill rates, lower CPMs, or in some cases, rejected ad requests.

To avoid this, the PATTERN macro can be used to provide page URL information to a third-party network or ad server. This information can then be added to the passback tag as a page_url attribute.

<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<div id="gpt-passback">
  <script>
    window.googletag = window.googletag || {cmd: []};
    googletag.cmd.push(function() {
        googletag.defineSlot('/6355419/Travel/Europe', [728, 90], 'gpt-passback')
          .addService(googletag.pubads());
        googletag.pubads().set('page_url', 'URL');
        googletag.enableServices();
        googletag.display('gpt-passback');
    });
  </script>
</div>