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

Native: add Native Custom Assets section #2713

Merged
merged 3 commits into from
Mar 3, 2021
Merged
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
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