Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mass custom configs #2807

Merged
merged 3 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dev-docs/modules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ If you are looking for bidder adapter parameters, see [Bidders' Params]({{site.b
| [**Advanced Size Mapping**](/dev-docs/modules/sizeMappingV2.html) | Display Responsive AdUnits in demanding page environments. |
| [**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 |
| [**MultiBid Module**](/dev-docs/modules/multibid.html) | Allows bidders to send multiple bids to the ad server. |

## Real-Time Data Providers
Expand Down
90 changes: 79 additions & 11 deletions dev-docs/modules/mass.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 |`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:

Expand Down