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

Display an out-of-page ad

This example displays an out-of-page ad using the Google Publisher Tag library. Learn more about out-of-page ads in the Google Ad Manager help center.

<!doctype html>
    <meta charset="utf-8">
    <title>Display an out-of-page ad</title>
    <script async src=""></script>
      window.googletag = window.googletag || {cmd: []};
      googletag.cmd.push(function() {
        // Use defineOutOfPageSlot instead of defineSlot when working with
        // out-of-page ads.
        googletag.defineOutOfPageSlot('/6355419/Travel', 'out-of-page-ad')
          .setTargeting('test', 'outofpage')
    <div id="out-of-page-ad">
        googletag.cmd.push(function() {