A Guide on Prebid Modules for Publishers

Updated on: January 3, 2024
Prebid aims to create a universal standard for header bidding. Besides the basics, publishers can leverage Prebid modules to do currency conversion, advanced size mapping, gather and pass the user’s consent, and more. If Prebid is an App Store, modules are Apps. 

There’s a lot more to Prebid.JS than what meets the eye. First, Prebid is open source. Second, it’s not really one product — it’s an entire Product Suite and can do more than just header bidding. With Prebid Modules, you can upgrade the header bidding suite to match your needs and in this piece, we’ll dive into everything you need to know about prebid modules. Let’s get started.

General Prebid Modules

Currency Module

The currency module enables you to automatically convert the currency of bidding partners into the base currency of your Ad Manager account. Let’s say you’re managing demand partners X and Y that return bids in dollars (USD) and euros (EUR).

In order to simplify reporting in Ad Manager and understand the overall revenue generated, you need to switch the bidding currency into the base currency of Ad Manager. Earlier, this could be done by using the BidderSettings.bidCpmAdjustment function.

However, if there were any fluctuations in the currency, the ad ops team or dev team had to manually adjust the pricing setting. So, Prebid introduced the ‘Currency module’. 

How does the Currency module work?

  1. A Prebid.JS file is created that contains the currency conversion code.
  2. The page configuration is done in a way that defines the primary currency set by you in the ad server.
  3. Based on the configuration of the page, Prebid loads the currency conversion file while the bidding is taking place.
  4. In real-time, the bids get converted into the currency as defined in the ad server.

Here’s a visual representation of the workflow of the Currency module in Prebid:

Workflow of Currency module in Prebid

Image Source: Prebid

An example of Currency conversion code in Prebid:

pbjs.setConfig({

    "currency": {

       "adServerCurrency": "JPY",

       "granularityMultiplier": 110,

       "defaultRates": { "USD": { "JPY": 110 }}

    }

});

The above code will translate the price bucket with a conversion rate of 110 Yen to 1 dollar. It also defines the default conversion rate as being 110 yen to the dollar.

Consent Management Module

The GDPR and CCPA give users substantial power and control over their personal data. To help you respect these rights, Prebid introduced GDPR Consent Management and US Privacy Management Module.

GDPR Consent Management Module: This module supports Consent Management Platforms, fetches users’ consent choices, shares them with the bidding adapters to process, and returns an ad.

US Privacy Consent Management Module: It is designed to support California Consumer Privacy Act. The module fetches the users’ consent, opt-out choices, and shares the information with the bidding adapters. A set-up example that supports both – GDPR and CCPA:

var pbjs = pbjs || {};

     pbjs.que = pbjs.que || [];

     pbjs.que.push(function() {

       pbjs.setConfig({

         consentManagement: {

           gdpr: {

            cmpApi: 'iab',

            allowAuctionWithoutConsent: false, // suppress auctions if there's no GDPR consent string

            timeout: 3000  // GDPR timeout 3000ms

           },

           usp: {

            timeout: 100 // US Privacy timeout 100ms

           }

         }

       });

     });

User ID Module

With header bidding, the user ID is a critical piece of information that must be synced between demand sources and publishers. Although user IDs (via cookie synchronization) are passed from SSPs to DSPs as part of the bid request, that will change once Google removes cookies by 2022. 

The User ID module is a move towards making header bidding still efficient as it enables you to share anonymized IDs with your SSPs and ad exchanges.

How does the User ID module work?

  1. You decide which user ID module to add. Prebid supports a number of User IDs such as IdentityLink, Unified ID 2.0, SharedID, and more. Consult with your legal counsel or DPO (if any) and ensure that you’re not violating any privacy law.
  2. Each User ID provider is represented by sub-modules in Prebid. You can learn more about various ID providers here.
  3. The user ID configuration is defined in the page by using the pbjs.setConfig() function. 
  4. When the pbjs.setConfig() is called and the user agrees to store the ID, the user ID module is invoked and the data is stored accordingly. In case the user changes the consent preference, the sub-modules refresh their ID and ensure that cache IDs are deleted when the user withdraws the consent.

When you integrate a user ID module with the Consent Management Platform (CMP), it will check the GDPR consent string. If there’s no consent string or the user doesn’t consent to Purpose 1, the call to external user ID vendors will not be made and nothing will be saved in local storage or cookies. Learn more about the integration of the Prebid User ID module.

Price Floor Module

This module was released in response to the growing need for publishers to be able to control their own ad prices in Prebid.js. Using the Prebid’s Price Floor module, you will be able to either set a floor price or use the floor price provided by a 3rd party vendor.

How does the Price Floor Module work?

  1. When building the Prebid.js package, Price Module is included with ‘gulp build-modules=priceFloors,..’. Using the module, you can set the price floor at ad unit level, and at the page level. Or you can set up a dynamic price floor retrieved from the third-party vendor.
  2. When setConfig({floor}) is defined/called, the Floor module builds a table for each auction based on rules (i.e. ad unit level or page level). If the dynamic price floor is enabled, the Floor module attempts to call the floor provider’s endpoint and fetch the data (i.e., the floor price for the auction).
  3. The bidding adapters are responsible for getting the price floor for each ad slot. If the bidder requests floors in a different currency, the Floor Price module is responsible for currency conversion.
  4. Once the bids are received from the demand-side platforms, the bidding partners return the floors to the Prebid. While returning, the Floors Module marks all the bids below the floor as ‘rejected’. Only eligible bids are submitted to your ad server.

A visual representation of how the Floor Price Module works are given below:

Workflow of Floor Price Module

Source: Prebid

Advanced Size Mapping Module

The Advanced Size Mapping module is an add-on for the responsive ad unit feature. This feature makes it easier to detect the dimensions of the browser’s viewport and enables you to determine:

  1. What banner size should be served
  2. What video player should be used for video ad creative
  3. Whether a native ad creative should be served
  4. Whether a particular SSP or ad exchange should participate in the auction

Here’s a sample code with Advanced Size Mapping in Prebid:

const adUnit = {

    code: "ad-slot-1",

    mediaTypes: {

      banner: {

        sizeConfig: [

          { minViewPort: [0, 0], sizes: [[300, 250], [300, 100]] },

          { minViewPort: [768, 0], sizes: [[728, 90], [300, 250]] },

          { minViewPort: [1200, 0], sizes: [[970, 90], [728, 90], [300, 250]] },

          { minViewPort: [1600, 0], sizes: [[1000, 300], [970, 90], [728, 90], [300, 250]] }

        ]

      }

    }

  }

Sidenote: Adding Advanced Size Mapping increases the size of your Prebid file by 12kB and it is recommended for publishers with complex website designs. Include the module when:

  • You serve different ad sizes and need to alter at different widths.
  • You need to alter different media types at different screen types.
  • You need to include/exclude some bidders at different ad size ranges.

ID Import Library Mapping

The ID Import Library is one of the prebid modules that provides an easy way to collect user information and generate a map of the identifiers available on the page. It is generally used by publishers who have multiple user ID solution providers on the website and thus, have multiple user ID sub-modules. To put it simply, use the module when you’re creating an identity graph.

How does the ID Import Library Module work?

  1. Prebid checks for a valid ‘idLibrary’ configuration.
  2. If the ‘target*’ is defined in the configuration file, and a valid ID entry (i.e. an email address) is found in it, MD5 (Known as Message-Digest Algorithm 5) hashes the entry, combines it with the user IDs from the User ID module, and returns it to the specified URL.
  3. If a valid ID entry isn’t found, then a listener is added to the element. A listener is nothing but a piece of code that tracks the behavior and preferences of users and automatically updates if there’s any change. Once the listener finds the value, MD5 repeats the same process of adding the user.
  4. If there’s no ‘target’ defined in the configuration file, then the module scans all the elements on the page. If a persistent value is found, MD5 repeats the same process.

*Target is the parameter from which the persistent value (or you can say the ID) is read.

An example of ID Import Library:

pbjs.setConfig({

    idImportLibrary:{

        url: 'url',

        target: 'username',

debounce: 250

    }

});

In the above snippet, 

  1. Url is the endpoint that is used to post the MD5 hashed emails.
  2. Debounce defines the time (in milliseconds) the module will wait before searching for the user ids and persistent ids on the page.
  3. Fullscan enables/disables you to scan the full page. By default, it stays disabled in the setup.

*Once the data is collected, it is posted in this format to the URL endpoint:

{

  "hid": "MD5 hash",

  "uids": "user ids array"

}

{

"hid":"5dd72a98c8146bafa84313fc15eb27c2",

"uids":

{

"id5id":"ID5-ZHMOQ7afBOa_gZxzTSelo5KFcVwCQgM7d-BUkWtjAA",

"sharedid":

{

"id":"01EE77EKRHXEZVJYMSQVRJ9536",

"third":"01EE77EKRHXEZVJYMSQVRJ9536"

}

}

}

Real-Time Data Provider Module

As you can surmise, the Real-Time Data Provider Module aims to provide you greater control over the ads served when running header bidding. For example, you can control what ads to serve or block, users’ data collection, etc. There are four important sub-modules that offer different purposes and if you want to use these sub-modules, you must have an account with the partners. Now, let’s have an overview of each one by one:

Browsi Viewability Module

Browsi is a well-known vendor that provides AI-based solutions to optimize ad viewability for publishers and advertisers. By integrating this module, you’ll be able to obtain insights on ad viewability while running header auctions.

All you have to do is to build the Browsi module into the Prebid.js package and use setConfig() to instruct the browser. Here’s a sample code for reference:

pbjs.setConfig({

        "realTimeData": {

            dataProviders:[{          

                "name": "browsi",

                "params": {

                    "url": "testUrl.com",   // get params values

                    "siteKey": "testKey",   // from Browsi

                    "pubKey": "testPub",    //

                    "keyName":"bv"          //

                }

            }]

        }

    });

Geoedge Real-time Module

Low-quality ads, automatic redirects, and malware-infected creatives are a massive problem that harms you as well as your users. By adding this module to your core Prebid module, you can detect and filter bad ads coming via bidding partners, which are often used to spread malware in the form of malware redirects, trojans, or exploit kits.

pbjs.setConfig({

    realTimeData: {

        dataProviders: [{

            name: 'geoedge',

            params: {

                key: '123123',       // obtain your key from Geoedge support

                bidders: {

                    'bidderA': true, // monitor bids form this bidder

                    'bidderB': false // do not monitor bids form this bidder.

                },

                wap: true

            }

        }]

    }

});

Sirdata Real-time Module

With users’ concerns about data privacy now being widely discussed, the demand for contextualization solutions is growing. This is something that Sirdata Real-time Module can help you with. Sirdata uses its proprietary technology for creating audience segments based on both – cookies and without cookies.

Using this module, you can send user-based segments and page-level contextual categories along with bid requests to your SSPs in order to optimize targeting. Here’s an example of the Sirdata Real-Time Data Provider module:

pbjs.setConfig(

    ...

    realTimeData: {

        auctionDelay: 1000,

        dataProviders: [

            {

                name: "SirdataRTDModule",

                waitForIt: true,

                params: {

                    partnerId: 1,

                    key: 1,

                    setGptKeyValues: true,

                    contextualMinRelevancyScore: 50, //Min score to filter contextual category globally (0-100 scale)

                    actualUrl: '', //top location url, for contextual categories

                    bidders: [{

                        bidder: 'appnexus',

                        adUnitCodes: ['adUnit-1','adUnit-2'],

                        customFunction: overrideAppnexus,

                        curationId: '111',

                    },{

                        bidder: 'ix',

                        sizeLimit: 1200 //specific to Index Exchange,

                        contextualMinRelevancyScore: 50, //Min score to filter contextual category for curation in the bidder (0-100 scale)

                    }]

                }

            }

        ]

Audigent Halo Real-time Module

Audigent is a first-party Data Management Platform that provides integrated post-cookie and real-time user segmentation solutions. To be specific, the DMP offers a Halo Identity solution that can seamlessly integrate with your bid request in order to identify the users.

Besides, Audigent maintains first-party TTD’s Unified ID, Halo ID, and other ID providers’ mappings to various third-party segments that can be utilized across different devices.

Video Module

  1. Google Ad Manager Video Module: If you want to use in-stream video ads and run prebid with Google Ad Manager, then this module is a must. Here’s a detailed tutorial on how to set up video ads in Google Ad Manager and conduct header auctions.
  2. Instream Video Ads Tracking: As an optional module, it allows analytics adapters and bidders’ adapters to measure the performance of in-stream video ads by tracking BID_WON events.
  3. Konduit ‘Accelerate’ Module: There’s no doubt that running video header bidding isn’t as easy as header bidding on display ad inventories. The involvement of additional technologies such as a video player, video ad tags (like VAST and VPAID) are meant to deliver to ad creatives.

However, there could be times when a video ad creative doesn’t start in real-time, causing revenue loss for you. So, if this sounds familiar and you’re looking for a solution to recover the lost video impressions and revenue, then you can utilize the Konduit Accelerate module*.

*Please note that Konduit is a managed video header bidding solution provider and you need to partner with the company before proceeding with the module.

What’s Next?

With the rapid growth of header bidding and publisher’s challenges to monetize high-traffic low-CPM inventory, more and more publishers are evaluating solutions to increase their revenue. Said that Prebid has been gaining a lot of attention recently and has redefined the standard by which publishers approach header bidding relationships with their demand partners, identity partners, or analytics providers.

Although we believe there is great potential for Prebid to power the next generation of programmatic ads, we fully understand that it may take time and resources to set up the prebid modules. So, if you need help in setting up Prebid on your website, we’re a click away.

News and Tips for Publishers

Get the inside scoop on publishing and programmatic with our 5-minute newsletter.