You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dev-docs/add-rtd-submodule.md
+40-31Lines changed: 40 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -6,16 +6,17 @@ sidebarType: 1
6
6
---
7
7
8
8
# How to Add a Real Time Data Submodule
9
+
9
10
{:.no_toc}
10
11
11
12
Sub-modules interact with the Real-Time Data (RTD) core module to
12
13
add data to bid requests or add targeting values for the primary ad server.
13
14
14
-
15
15
* TOC
16
16
{:toc }
17
17
18
18
## Overview
19
+
19
20
The point of the Real Time Data (RTD) infrastructure is to make configuration consistent for publishers. Rather than having dozens of different modules with disparate config approaches, being a Real-Time Data sub-module means plugging into a framework
20
21
for publishers to control how sub-modules behave. For example, publishers can define how long the auction can be delayed and give some
21
22
sub-modules priority over others.
@@ -40,13 +41,13 @@ Here is the flow for how the RTD-core module interacts with its sub-modules:
40
41
The activities performed by the RTD-core module are on the left-hand side, while the functions
41
42
that can be provided by your RTD sub-module are on the right-hand side. Note that you don't need to implement all of the functions - you'll want to plan out your functionality and develop the appropriate functions.
42
43
43
-
44
44
## Creating a Sub-Module
45
45
46
46
When you create a Real-Time Data sub-module, you will be operating under the umbrella of the Real-Time Data core module. Here are the services core provides:
47
-
- your sub-module will be initialized as soon as pbjs.setConfig({realTimeData}) is called. If you can initialize at the time of code load, that can be done at the bottom of your javascript file.
48
-
- whenever any of your functions is called, it will be passed the config params provided by the publisher. As a result, you should not call getConfig().
49
-
- your functions will also be passed all available privacy information. As a result, you do not need to query to get GDPR, US Privacy, or any other consent parameters.
47
+
48
+
* your sub-module will be initialized as soon as pbjs.setConfig({realTimeData}) is called. If you can initialize at the time of code load, that can be done at the bottom of your javascript file.
49
+
* whenever any of your functions is called, it will be passed the config params provided by the publisher. As a result, you should not call getConfig().
50
+
* your functions will also be passed all available privacy information. As a result, you do not need to query to get GDPR, US Privacy, or any other consent parameters.
50
51
51
52
Working with any Prebid project requires using Github. In general, we recommend the same basic workflow for any project:
52
53
@@ -65,7 +66,8 @@ with the [module rules](/dev-docs/module-rules.html) that apply globally and to
65
66
Create a markdown file under `modules` with the name of the module suffixed with 'RtdProvider', e.g., `exRtdProvider.md`
66
67
67
68
Example markdown file:
68
-
{% highlight text %}
69
+
70
+
```md
69
71
# Overview
70
72
71
73
Module Name: Ex Rtd Provider
@@ -90,7 +92,7 @@ In order to let RTD-core know where to find the functions in your sub-module, cr
90
92
| param name | type | Scope | Description | Params |
| name | string | required | must match the name provided by the publisher in the on-page config | n/a |
93
-
| gvlid | number | optional | global vendor list ID for your submodule | n/a |
95
+
| gvlid | number | optional | global vendor list ID for your submodule | n/a |
94
96
| init | function | required | defines the function that does any auction-level initialization required | config, userConsent |
95
97
| getTargetingData | function | optional | defines a function that provides ad server targeting data to RTD-core | adUnitArray, config, userConsent |
96
98
| getBidRequestData | function | optional | defines a function that provides bid request data to RTD-core | reqBidsConfigObj, callback, config, userConsent |
@@ -100,7 +102,8 @@ In order to let RTD-core know where to find the functions in your sub-module, cr
100
102
| onBidResponseEvent | function |optional | listens to the BID_RESPONSE event and calls a sub-module function that lets it know when a bid response has been collected | bidResponse, config, userConsent |
*[usp](/dev-docs/modules/consentManagementUsp.html#bidder-adapter-us-privacy-integration) - US Privacy (aka CCPA)
128
+
*[coppa](/dev-docs/publisher-api-reference/setConfig.html#setConfig-coppa) - the Child Online Privacy Protection Act
125
129
126
130
These are provided so you can do the right thing with respect to regulations. The only privacy requirement imposed by the RTD-core is that sub-modules make make use of the StorageManager instead of attempting to access cookies or localstorage directly.
127
131
128
132
#### The init() function
133
+
129
134
1. This function receives module configuration and userConsent parameters
130
135
2. If the function returns `false`, the submodule will be ignored.
131
136
@@ -137,7 +142,8 @@ This is the function that will allow RTD sub-modules to merge ad server targetin
137
142
138
143
1. RTD-core will call this function with an array of adUnits, config, and userConsent as parameters
139
144
2. Your sub-module should respond with per-adslot data that should be set as key values on the ad server targeting in this format:
140
-
{% highlight text %}
145
+
146
+
```json
141
147
{
142
148
"slotA":{
143
149
"p":0.56, // ad server targeting variable (e.g. p) for slotA is 0.56
@@ -150,7 +156,7 @@ This is the function that will allow RTD sub-modules to merge ad server targetin
This is the function that will allow RTD sub-modules to modify the AdUnit object for each auction. It's called as part of the requestBids hook.
178
184
179
185
1. RTD-core will call this function with:
180
-
- reqBidsConfigObj: a slightly modified version of the object that's passed to `pbjs.requestBids` (see [below](#reqBidsConfigObj)). Note that several auctions can happen concurrently, so the sub-module must be ready to support this.
181
-
- callback: lets RTD-core know which auction the sub-module is done with.
182
-
- config: the sub-module's config params provided by the publisher
183
-
- userConsent object (see above)
186
+
1. reqBidsConfigObj: a slightly modified version of the object that's passed to `pbjs.requestBids` (see [below](#reqBidsConfigObj)). Note that several auctions can happen concurrently, so the sub-module must be ready to support this.
187
+
2. callback: lets RTD-core know which auction the sub-module is done with.
188
+
3. config: the sub-module's config params provided by the publisher
189
+
4. userConsent object (see above)
184
190
2. Your sub-module may update the reqBidsConfigObj and hit the callback. To inject data into the bid requests, you should follow one of these conventions:
185
-
- Recommended: use one of these [First Party Data](/features/firstPartyData.html) conventions:
186
-
- For AdUnit-specific first party data, set AdUnit.ortb2Imp.ext.data.ATTRIBUTES
187
-
- For global first party data, including bidder-specific data, modify the `reqBidsConfigObj` as shown [below](#reqBidsConfigObj)
188
-
- Not recommended: Place your data in bidRequest.rtd.RTDPROVIDERCODE.ATTRIBUTES and then get individual adapters to specifically read that location. Note that this method won't pass data to Prebid Server adapters.
191
+
1. Recommended: use one of these [First Party Data](/features/firstPartyData.html) conventions:
192
+
1. For AdUnit-specific first party data, set AdUnit.ortb2Imp.ext.data.ATTRIBUTES
193
+
2. For global first party data, including bidder-specific data, modify the `reqBidsConfigObj` as shown [below](#reqBidsConfigObj)
194
+
2. Not recommended: Place your data in bidRequest.rtd.RTDPROVIDERCODE.ATTRIBUTES and then get individual adapters to specifically read that location. Note that this method won't pass data to Prebid Server adapters.
189
195
190
-
<a id="reqBidsConfigObj" />
196
+
<aid="reqBidsConfigObj"></a>
191
197
192
198
The `reqBidsConfigObj` parameter is a copy of the object passed to [`requestBids`](/dev-docs/publisher-api-reference/requestBids.html), except for:
193
199
194
-
- `adUnits` and `timeout` are always defined (if the publisher didn't provide them, the default values are filled in - `pbjs.adUnits` and `getConfig('bidderTimeout')` respectively)
195
-
- `ortb2` is replaced with an `ortb2Fragments` object, intended to be inspected and / or modified by your module.
200
+
*`adUnits` and `timeout` are always defined (if the publisher didn't provide them, the default values are filled in - `pbjs.adUnits` and `getConfig('bidderTimeout')` respectively)
201
+
*`ortb2` is replaced with an `ortb2Fragments` object, intended to be inspected and / or modified by your module.
196
202
197
203
The `ortb2Fragments` parameter is an object containing two properties:
198
204
199
-
- `global`, an object containing global (not bidder-specific) first party data in the same OpenRTB format used by `setConfig({ortb2})`
200
-
- `bidder`, a map from bidder code to bidder-specific, OpenRTB-formatted first party data.
205
+
*`global`, an object containing global (not bidder-specific) first party data in the same OpenRTB format used by `setConfig({ortb2})`
206
+
*`bidder`, a map from bidder code to bidder-specific, OpenRTB-formatted first party data.
201
207
202
208
Your module may modify either or both with additional data. If adding bidder-specific data in `ortb2Fragments.bidder`, it should also support a parameter to allow the publisher to define which bidders are to receive the data.
203
209
@@ -207,7 +213,7 @@ at the time `requestBids` is called, and RTD submodules that wish to modify it a
1. Use this function to take action to make sure data will be served as soon as possible (AJAX calls, pixels, etc..)
240
247
2. This function is **not** invoked by the RTD module, and should be invoked at the bottom of the submodule.
241
248
242
249
#### Using event listeners
250
+
243
251
1. The RTD-core module listens for 3 events - `AUCTION_INIT`, `AUCTION_END`, and `BID_RESPONSE`.
244
252
2. Each time one of the events fires, RTD-core will invoke the corresponding function on each sub-module, allowing the sub-module to make changes to the event object.
245
253
3. To use this on your sub-module, define the required functions as noted in the table above and the examples below.
246
254
247
255
**Code Example**
248
256
249
257
Here is a code example with both mandatory and optional functions:
250
-
{% highlight text %}
258
+
259
+
```javascript
251
260
/**@type{RtdSubmodule}*/
252
261
exportconstsubModuleObj= {
253
262
name:'ExampleRTDModule3',
@@ -288,7 +297,6 @@ function beforeInit(){
288
297
beforeInit();
289
298
```
290
299
291
-
292
300
### Step 3: Add unit tests
293
301
294
302
1. Create a JS file under `test/spec/modules` with the name of the bidder suffixed with 'RtdProvider_spec', e.g., `exRtdProvider_spec.js`
@@ -305,7 +313,7 @@ Once everything looks good, submit the code, tests, and markdown as a pull reque
305
313
306
314
2. Create a new file for your RTD sub-module in dev-docs/modules/ExampleRtdProvider.md. Take a look at the other *RtdProvider.md files in that directory for the important header values. Specifically it requires the following:
307
315
308
-
```
316
+
```markdown
309
317
---
310
318
layout: page_v2
311
319
title: Example Module
@@ -322,6 +330,7 @@ Once everything looks good, submit the code, tests, and markdown as a pull reque
322
330
323
331
[Useful publisher-facing documentation]
324
332
```
333
+
325
334
3. Submit the pull request to the prebid.github.io repo.
Copy file name to clipboardExpand all lines: dev-docs/add-video-submodule.md
+19-15Lines changed: 19 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,10 @@ sidebarType: 1
9
9
{:.no_toc}
10
10
11
11
Video submodules interact with the Video Module to integrate Prebid with Video Players, allowing Prebid to automatically:
12
-
- render bids in the desired video player.
13
-
- mark used bids as won.
14
-
- trigger player and media events.
15
-
- populate the oRTB Video Impression and Content params in the bid request.
12
+
* render bids in the desired video player.
13
+
* mark used bids as won.
14
+
* trigger player and media events.
15
+
* populate the oRTB Video Impression and Content params in the bid request.
16
16
17
17
* TOC
18
18
{:toc }
@@ -28,11 +28,12 @@ Publishers who use players from different vendors on the same page can use multi
28
28
## Requirements
29
29
30
30
The Video Module only supports integration with Video Players that meet the following requirements:
31
-
- Must support parsing and reproduction of VAST ads.
32
-
- Input can be an ad tag URL or the actual Vast XML.
33
-
- Must expose an API that allows the procurement of [Open RTB params](https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf) for Video (section 3.2.7) and Content (section 3.2.16).
34
-
- Must emit javascript events for Ads and Media.
35
-
- see [Event Registration](#event-registration).
31
+
32
+
* Must support parsing and reproduction of VAST ads.
33
+
* Input can be an ad tag URL or the actual Vast XML.
34
+
* Must expose an API that allows the procurement of [Open RTB params](https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf) for Video (section 3.2.7) and Content (section 3.2.16).
35
+
* Must emit javascript events for Ads and Media.
36
+
* see [Event Registration](#event-registration).
36
37
37
38
## Creating a Submodule
38
39
@@ -49,7 +50,8 @@ Working with any Prebid project requires using Github. In general, we recommend
49
50
Create a markdown file under `modules` with the name of the module suffixed with 'VideoProvider', i.e. `exampleVideoProvider.md`.
50
51
51
52
Example markdown file:
52
-
{% highlight text %}
53
+
54
+
```md
53
55
# Overview
54
56
55
57
Module Name: Example Video Provider
@@ -73,7 +75,7 @@ Your page must link the Example Player build from our CDN. Alternatively you can
73
75
Vendor codes are required to indicate which submodule type to instantiate. Add your vendor code constant to an export const in `vendorCodes.js` in Prebid.js under `libraries/video/constants/vendorCodes.js`.
74
76
i.e. in `vendorCodes.js`:
75
77
76
-
{% highlight text %}
78
+
```javascript
77
79
exportconstEXAMPLE_PLAYER_VENDOR=3;
78
80
```
79
81
@@ -89,7 +91,7 @@ Your submodule should also import the `submodule` function from `src/hook.js` an
@@ -43,24 +44,24 @@ In order to provide a fast and safe header bidding environment for publishers, t
43
44
{: .alert.alert-danger :}
44
45
The above list is **not** the full list of requirements. Failure to follow any of the required conventions defined in the [Module Rules](/dev-docs/module-rules.html) could lead to delays in approving your adapter for inclusion in Prebid.js. If you'd like to apply for an exception to one of the rules, make your request in a new [Prebid.js issue](https://github.com/prebid/Prebid.js/issues).
45
46
46
-
<aname="bidder-adaptor-Required-Files" />
47
+
<aname="bidder-adaptor-Required-Files"></a>
47
48
48
49
### Required Files
49
50
50
51
With each adapter submission, there are two files required to be in the pull request:
51
52
52
53
*`modules/exampleBidAdapter.js`: the file containing the code for the adapter
53
54
*`modules/exampleBidAdapter.md`: a markdown file containing key information about the adapter:
54
-
* The contact email of the adapter's maintainer.
55
-
* A test ad unit that will consistently return test creatives. This helps us to ensure future Prebid.js updates do not break your adapter. Note that if your adapter supports video (instream and/or outstream context) or native, you must also provide example parameters for each type.
55
+
* The contact email of the adapter's maintainer.
56
+
* A test ad unit that will consistently return test creatives. This helps us to ensure future Prebid.js updates do not break your adapter. Note that if your adapter supports video (instream and/or outstream context) or native, you must also provide example parameters for each type.
@@ -188,11 +190,11 @@ If you're the type that likes to skip to the answer instead of going through a t
188
190
{: .alert.alert-warning :}
189
191
If your adapter interfaces with an ORTB backend, you may take advantage of Prebid's [ORTB conversion library](https://github.com/prebid/Prebid.js/blob/master/libraries/ortbConverter/README.md), which provides most of the implementation for `buildRequests` and `interpretResponse`.
190
192
191
-
+[Overview](#bidder-adaptor-Overview)
192
-
+[Building the Request](#bidder-adaptor-Building-the-Request)
193
-
+[Interpreting the Response](#bidder-adaptor-Interpreting-the-Response)
194
-
+[Registering User Syncs](#bidder-adaptor-Registering-User-Syncs)
195
-
+[Registering on Timeout](#bidder-adaptor-Registering-on-Timout)
193
+
*[Overview](#bidder-adaptor-Overview)
194
+
*[Building the Request](#bidder-adaptor-Building-the-Request)
195
+
*[Interpreting the Response](#bidder-adaptor-Interpreting-the-Response)
196
+
*[Registering User Syncs](#bidder-adaptor-Registering-User-Syncs)
197
+
*[Registering on Timeout](#bidder-adaptor-Registering-on-Timout)
196
198
197
199
<aname="bidder-adaptor-Overview" />
198
200
@@ -1317,5 +1319,5 @@ The Prebid.org [download page](/download.html) will automatically be updated wit
0 commit comments