Skip to content

Commit

Permalink
Native: add Native Custom Assets section (#2713)
Browse files Browse the repository at this point in the history
* Native: add Custom Assets section

* wordsmithing

* Update native-implementation.md

Co-authored-by: bretg <bgorsline@gmail.com>
  • Loading branch information
osazos and bretg authored Mar 3, 2021
1 parent 2c1a526 commit ac9d560
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions prebid/native-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ The Prebid.js AdUnit needs to defines a native mediatype object to tell bidders
| ASSETCODE. aspect_ratios.min_height | optional | Part of the aspect_ratios object, bidders may pass this value through to the endpoint. Prebid.js does not enforce the responses and there’s no default. | 75 | integer |
| ASSETCODE. aspect_ratios.ratio_width | optional | Part of the aspect_ratios object, bidders may pass this value through to the endpoint. Prebid.js does not enforce the responses and there’s no default. | 2 | integer |
| ASSETCODE. aspect_ratios.ratio_height | optional | Part of the aspect_ratios object, bidders may pass this value through to the endpoint. Prebid.js does not enforce the responses and there’s no default. | 3 | integer |
| ext.CUSTOMASSET | optional | Non-standard or bidder-specific assets can be supplied on the `ext` here. Attributes on custom assets are documented by the vendor. | | |


**Table 3: Native Assets Recognized by Prebid.js**
Expand All @@ -101,6 +102,38 @@ Specific bidders may not support all of the fields listed below or may return di

{% include dev-docs/native-image-asset-sizes.md %}

### 3.2 Custom native assets

In order to fit special bidder requirements, Prebid.js supports defining assets beyond the standard set. Simply define custom attributes in mediaTypes.native.ext, and they can be retrieved at render time. Other than being under the `ext` object, custom assets are declared in the same way as the standard ones.

{: .alert.alert-success :}
Note: The `native-render.js::renderNativeAd()` function must be called with `requestAllAssets: true`.

Bid adapters will declare which custom assets they support in their documentation. It is recommended to prefix the asset name with the bidderCode to avoid collision issues.

```javascript
mediaTypes {
native: {
body: {
required: true
},
ext: {
bidderA_specialtracking: { // custom asset
required: false
}
}
}
```
In the native template, simply access the custom value with the normal Prebid ##macro## format assuming `hb_native_` as the prefix. For example:
```
<div id="mytemplate">
... render a lovely creative ...
... refer to ##hb_native_bidderA_specialtracking## when appropriate ...
</div>
```
## 4. Implementing the Native Template
- If you want to manage your creative within the ad server (e.g. Google Ad Manager), follow the instructions for [AdServer-Defined Creative](#4-implementing-adserver-defined-creative).
Expand Down

0 comments on commit ac9d560

Please sign in to comment.