Skip to content

Commit

Permalink
Add targetingControls.addTargetingKeys configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed Nov 10, 2021
1 parent 0027ca3 commit 7cbfba9
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions dev-docs/publisher-api-reference/setConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ The `targetingControls` object passed to `pbjs.setConfig` provides some options
| auctionKeyMaxChars | integer | Specifies the maximum number of characters the system can add to ad server targeting. |
| alwaysIncludeDeals | boolean | If [enableSendAllBids](#setConfig-Send-All-Bids) is false, set this value to `true` to ensure that deals are sent along with the winning bid |
| allowTargetingKeys | Array of Strings | Selects supported default targeting keys. |
| addTargetingKeys | Array of Strings | Selects targeting keys to be supported in addition to the default ones |
| allowSendAllBidsTargetingKeys | Array of Strings | Selects supported default targeting keys. |

{: .alert.alert-info :}
Expand Down Expand Up @@ -812,6 +813,8 @@ Between these two values (Prebid's targeting key count and the overall ad URL qu

Between this feature and the overlapping [sendBidsControl.bidLimit](/dev-docs/publisher-api-reference/setConfig.html#setConfig-Send-Bids-Control), you should be able to make sure that there's not too much data going to the ad server.

<a name="targetingControls-allowTargetingKeys" />

##### Details on the allowTargetingKeys setting

The `allowTargetingKeys` config creates a targeting key mask based on the default targeting keys defined in CONSTANTS.TARGETING_KEYS and CONSTANTS.NATIVE_KEYS. Any default keys that do not match the mask will not be sent to the adserver. This setting can be helpful if you find that your default Prebid.js implementation is sending key values that your adserver isn't configured to process; extraneous key values may lead to the ad server request being truncated, which can cause potential issues with the delivery or rendering ads.
Expand Down Expand Up @@ -879,6 +882,65 @@ config.setConfig({
});
```

<a name="targetingControls-addTargetingKeys" />

##### Details on the addTargetingKeys setting

The `addTargetingKeys` config is similar to `allowTargetingKeys`, except it adds to the keys in CONSTANTS.DEFAULT_TARGETING_KEYS instead of replacing them. This is useful if you need Prebid.js to generate targeting for some keys that are not allowed by default without removing any of the default ones (see [allowTargetingKeys](#targetingControls-allowTargetingKeys) for details on how targeting is generated).

Note that you may specify only one of `allowTargetingKeys` or `addTargetingKeys`.

For example, this allows every default key, plus `hb_adomain`:

```javascript
config.setConfig({
targetingControls: {
addTargetingKeys: ['ADOMAIN']
}
});
```

Which is equivalent to:

```javascript
config.setConfig({
targetingControls: {
allowTargetingKeys: [
'BIDDER',
'AD_ID',
'PRICE_BUCKET',
'SIZE',
'DEAL',
'FORMAT',
'UUID',
'CACHE_HOST',
'title',
'body',
'body2',
'privacyLink',
'privacyIcon',
'sponsoredBy',
'image',
'icon',
'clickUrl',
'displayUrl',
'cta',
'rating',
'address',
'downloads',
'likes',
'phone',
'price',
'salePrice',
'rendererUrl',
'adTemplate',
'ADOMAIN'
]
}
});
```


##### Details on the allowSendAllBidsTargetingKeys setting

The `allowSendAllBidsTargetingKeys` is similar to `allowTargetingKeys` except it limits any default bidder specific keys sent to the adserver when sendAllBids is enabled. Any default bidder specific keys that do not match the mask will not be sent to the adserver. This setting can be helpful if you find that your default Prebid.js implementation is sending key values that your adserver isn't configured to process; extraneous key values may lead to the ad server request being truncated, which can cause potential issues with the delivery or rendering ads. An example of an extraneous key value many publishers may find redundant and want to remove is `hb_bidder_biddercode = biddercode`.
Expand Down

0 comments on commit 7cbfba9

Please sign in to comment.