Skip to content

Latest commit

 

History

History
166 lines (139 loc) · 6.69 KB

File metadata and controls

166 lines (139 loc) · 6.69 KB
layout page_v2
title Prebid.js Modules
description Module Documentation
sidebarType 1

Prebid.js Module Overview

{:.no_toc}

The core of Prebid.js contains only the foundational code needed for header bidding. Any functionality that could be considered an add-on is part of a module. These are the major categories:

{% assign module_pages = site.pages | where: "page_type", "module" %}

Recommended Modules

Prebid.org highly recommends that publishers utilize the following modules:

{% for page in module_pages %}{% if page.recommended == true %} {% endif %}{% endfor %}
Module Description
{{page.display_name}} {{page.description}}

General Modules

Modules in the Real-Time Data (RTD) category conform to a consistent set of publisher controls. The publisher can choose to run multiple RTD modules, define an overall amount of time they're willing to wait for results, and even flag some of the modules as being higher priority than others. See the realTimeData setConfig reference for more details.

{% for page in module_pages %}{% if page.recommended == true or page.vendor_specific == true or page.enable_download == false %}{% continue %}{% endif %} {% if page.module_type == "rtd" %}{% else %}{% endif %} {% endfor %}
Module Description RTD?
{{page.display_name}} {{page.description}}yesno

Vendor-Specific Modules

These modules may require accounts with a service provider.

{% for page in module_pages %}{% if page.recommended == true or page.enable_download == false %}{% continue %}{% endif %}{% if page.vendor_specific == true %} {% if page.module_type == "rtd" %}{% else %}{% endif %} {% endif %}{% endfor %}
Module Description RTD?
{{page.display_name}} {{page.description}}yesno

User ID Modules

UserID modules conform to a consistent set of publisher controls. The publisher can choose to run multiple user id modules, define an overall amount of time they're willing to wait for results. See the userSync setConfig reference and the User ID Module for more details.

{% assign userid_module_pages = site.pages | where: "layout", "userid" %}

{% for page in userid_module_pages %} {% endfor %}
Module Description EID Source
{{page.title}} {{page.description}} {{page.eidsource}}

Loading modules separately

There are situations where a publisher uses different modules depending on various factors, such as specific pages or locations. This creates the inconvenience of having to load a Prebid build that is larger than what a particular page actually needs. While it’s possible to work around this by creating separate Prebid builds for different pages, that approach doesn’t scale well. Since a Prebid build is composed of concatenated chunks, it’s possible to load modules separately, allowing you to have a main Prebid file that contains only the modules shared across all pages.

Example

This is the example of loading modules separately for the self-hosted (e.g. CDN) Prebid build. Instructions for importing modules when using the npm package can be found in the Readme file

  1. Perform full Prebid build gulp build
  2. Generate the main prebid.js file containing only the modules required across all pages: gulp bundle --modules=<...>
  3. Host build/dist folder content on your server or CDN
  4. Check the dependencies of the modules you plan to load dynamically on the current page Dependency tree
  5. Load the required modules, their dependencies using script tags:
<html>
<head>
    <title>Page 1</title>>
    <script src="https://<your-cdn>/prebid/ortbConverter.js"></script> <!-- Depedency of openxBidAdapter !-->
    <script src="https://<your-cdn>/prebid/openxBidAdapter.js"></script> <!-- Bid adapter module !-->
    <script src="https://<your-cdn>/prebid/id5IdSystem.js"></script> <!-- Another module (doesn't require any additional dependencies) !-->
    <script src="https://<your-cdn>/prebid/prebid.js"></script> <!-- Load prebid.js last !-->
</head>

Storage control usage

When working with the storageControl module you will need to explicitly import disclosure metadata. To do this, pair each module import with its corresponding metadata file <module>.metadata.js

<html>
<head>
    <title>Page 1</title>>
    <script src="https://<your-cdn>/prebid/ortbConverter.js"></script> <!-- Depedency of openxBidAdapter !-->
    <script src="https://<your-cdn>/prebid/openxBidAdapter.js"></script> <!-- Bid adapter module !-->
    <script src="https://<your-cdn>/prebid/openxBidAdapter.metadata.js"></script> <!-- Bid adapter module's metadata !-->
    <script src="https://<your-cdn>/prebid/id5IdSystem.js"></script> <!-- Another module (doesn't require any additional dependencies) !-->
    <script src="https://<your-cdn>/prebid/id5IdSystem.metadata.js"></script> <!-- Another module's metadata !-->
    <script src="https://<your-cdn>/prebid/prebid.js"></script> <!-- Load prebid.js last !-->
</head>

Further Reading