Techdocs

AMP Web SDK

AMP player

Using Prebid with AMP

Implementation of Prebid in AMP.

The plugin can be implemented by providing a prebid object to the player config:

var config = {
  plugins: {
    prebid: {
      resources: [
        {src: "${paths.plugins}prebid/libs/prebid2.4.0.js", type: "text/javascript", async: true},
        {src: "${paths.plugins}prebid/Prebid.js", type: "text/javascript", async: true}
      ],
      adUnits: [{
        code: 'video1',
        mediaTypes: {
          video: {
            playerSize: [640, 480],
            context: 'instream'
          }
        },
        bids: [{
          bidder: 'spotx',
          params: {
            channel_id: 79391
          }
        }]
      }]
    }
  }
};
akamai.amp.AMP.create("amp", config);

Using custom prebid options property.

var config = {
  plugins: {
    prebid: {
      resources: [
        {src: "${paths.plugins}prebid/libs/prebid2.4.0.js", type: "text/javascript", async: true},
        {src: "${paths.plugins}prebid/Prebid.js", type: "text/javascript", async: true}
      ],
      adUnits: [{
        code: 'video1',
        mediaTypes: {
          video: {
            playerSize: [640, 480],
            context: 'instream'
          }
        },
        bids: [{
          bidder: 'spotx',
          params: {
            channel_id: 79391
          }
        }]
      }],
      options: {
        debug:true,
        cache: {
          url: 'https://prebid.adnxs.com/pbc/v1/cache'
        }
      }
    }
  }
};
akamai.amp.AMP.create("amp", config);

Multi header bidders can be implemented within the same prebid configuration:

var config = {
  plugins: {
    prebid: {
      resources: [
        {src: "${paths.plugins}prebid/libs/prebid2.4.0.js", type: "text/javascript", async: true},
        {src: "${paths.plugins}prebid/Prebid.js", type: "text/javascript", async: true}
      ],
      adUnits: [{
        code: "my-video-tag",
        sizes: [
          640,
          480
        ],
        mediaTypes: {
          video: {
            context: "instream",
            playerSize: [
              640,
              480
            ]
          }
        },
        bids: [{
          bidder: "appnexus",
          params: {
            placementId: 13144370,
            video: {
              skippable: true,
              playback_method: [
                "auto_play_sound_off"
              ]
            }
          }
        }]
      }, {
        code: 'video1',
        mediaTypes: {
          video: {
            playerSize: [640, 480],
            context: 'instream'
          }
        },
        bids: [{
          bidder: 'spotx',
          params: {
            channel_id: 79391
          }
        }]
      }]
    }
  }
};
akamai.amp.AMP.create("amp", config);