From b830a5257308e739a0a5a5bd6065c1f8b308bf28 Mon Sep 17 00:00:00 2001 From: Catalin Ciocov Date: Mon, 29 Mar 2021 10:19:53 +0300 Subject: [PATCH 1/2] Updated docs for MASS module --- dev-docs/modules/mass.md | 90 +++++++++++++++++++++++++++++++++++----- 1 file changed, 79 insertions(+), 11 deletions(-) diff --git a/dev-docs/modules/mass.md b/dev-docs/modules/mass.md index b65efb46db..adae3af75e 100644 --- a/dev-docs/modules/mass.md +++ b/dev-docs/modules/mass.md @@ -33,10 +33,11 @@ Find out more [here](https://massplatform.net). {: .alert.alert-warning :} ## Disclosure -- This module loads external JavaScript to render creatives +This module loads external JavaScript to render creatives -## Generic Mode -- You can specify your our own renderUrl using the module configuration option. When specifying a custom renderer, quality assurance is your responsibility. +## Custom Mode + +You can specify your own `dealIdPattern` and `renderUrl` by adding one or more entries into the `custom` configuration option (see [Configuration Parameters](#configuration-parameters) below). When specifying a custom renderer, quality assurance is your responsibility. ## Integration @@ -55,23 +56,90 @@ pbjs.que.push(function() { mass: { enabled: true, renderUrl: 'https://cdn.massplatform.net/bootloader.js', - dealIdPattern: /^MASS/i + dealIdPattern: /^MASS/i, + custom: [ + { + dealIdPattern: /xyz/, + renderUrl: 'https://my.domain.com/render.js', + namespace: 'xyz' + } + ] } }); }); ``` -Parameters details: +### Configuration Parameters -|Name |Type |Description |Default | +|Name |Type |Description |Notes | | :------------ | :------------ | :------------ |:------------ | -|enabled | Boolean |Enable/disable the module |`true` | -|renderUrl | String |The render script to use | | -|dealIdPattern | RegExp |The pattern used to identify MASS deal IDs |`/^MASS/i` | +|enabled | Boolean |Enable/disable the module |Defaults to `true` | +|dealIdPattern | RegExp |The pattern used to identify MASS deal IDs |Defaults to `/^MASS/i` | +|renderUrl | String |The MASS render script to load |Must be set to `https://cdn.massplatform.net/bootloader.js` | +|custom | Array |Add custom renderers | | +|custom[].dealIdPattern | RegExp |A pattern used to identify matching deal IDs |Either this parameter or `custom[].match` must be specified | +|custom[].renderUrl | String |The render script to load |Either this parameter or `custom[].render` must be specified | +|custom[].namespace | String |The namespace (i.e.: object) created on `window` to pass parameters to the render script |Required with `custom[].renderUrl` | +|custom[].match | Function(bid) |A custom function to identify matching bids |Either this parameter or `custom[].dealIdPattern` must be specified | +|custom[].render | Function(payload) |A custom function to render the matchig/winning bid |Either this parameter or `custom[].renderUrl` must be specified. The `payload` parameter contains: `payload.bid`, `payload.bidRequest`, `payload.adm` | + +### Example Configurations + +### Only (official) MASS support enabled + +```js +pbjs.que.push(function() { + pbjs.setConfig({ + mass: { + renderUrl: 'https://cdn.massplatform.net/bootloader.js' + } + }); +}); +``` + +### MASS support disabled, custom renderer enabled + +```js +pbjs.que.push(function() { + pbjs.setConfig({ + mass: { + custom: [ + { + dealIdPattern: /xyz/, + renderUrl: 'https://my.domain.com/render.js', + namespace: 'xyz' + } + ] + } + }); +}); +``` + +### Custom `match` and `render` + +```js +pbjs.que.push(function() { + pbjs.setConfig({ + mass: { + custom: [ + { + match: function(bid) { + // return true/false if matching/non-matching bid + }, + + render: function(payload) { + console.log(payload); + } + } + ] + } + }); +}); +``` -## Example +## Integration Example -To view an integration example: +To view the integration example: 1) in your cli run: From f1d6aa56e16a898d311abde1de08602b1f2bb00e Mon Sep 17 00:00:00 2001 From: Catalin Ciocov Date: Mon, 29 Mar 2021 13:08:17 +0300 Subject: [PATCH 2/2] Add MASS to the list of global modules --- dev-docs/modules/index.md | 1 + dev-docs/modules/mass.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dev-docs/modules/index.md b/dev-docs/modules/index.md index 3d43a16ac4..aa472a2415 100644 --- a/dev-docs/modules/index.md +++ b/dev-docs/modules/index.md @@ -39,6 +39,7 @@ If you are looking for bidder adapter parameters, see [Bidders' Params]({{site.b | [**Price Floors Module**](/dev-docs/modules/floors.html) | Configure and enforce minimum bids. | | [**GPT Pre-Auction Module**](/dev-docs/modules/gpt-pre-auction.html) | Adds a PB Ad Slot and matching GAM ad unit name to each ad unit's first-party data before bid requests are sent to the adapters. | | [**ID Import Library**](/dev-docs/modules/idLibrary.html) | Retrieve user ids deployed on your site, and return them to a configurable endpoint for ID Graphing | +| [**MASS**](/dev-docs/modules/mass.html) | Enables the MASS protocol for Prebid and custom renderers by DealID | ## Real-Time Data Providers diff --git a/dev-docs/modules/mass.md b/dev-docs/modules/mass.md index adae3af75e..d447773ca3 100644 --- a/dev-docs/modules/mass.md +++ b/dev-docs/modules/mass.md @@ -75,7 +75,7 @@ pbjs.que.push(function() { | :------------ | :------------ | :------------ |:------------ | |enabled | Boolean |Enable/disable the module |Defaults to `true` | |dealIdPattern | RegExp |The pattern used to identify MASS deal IDs |Defaults to `/^MASS/i` | -|renderUrl | String |The MASS render script to load |Must be set to `https://cdn.massplatform.net/bootloader.js` | +|renderUrl | String |The MASS render script to load |`https://cdn.massplatform.net/bootloader.js` | |custom | Array |Add custom renderers | | |custom[].dealIdPattern | RegExp |A pattern used to identify matching deal IDs |Either this parameter or `custom[].match` must be specified | |custom[].renderUrl | String |The render script to load |Either this parameter or `custom[].render` must be specified |