Skip to content

Commit 1e60824

Browse files
author
Michele Nasti
committed
fixes
1 parent 14bbb80 commit 1e60824

File tree

1 file changed

+2
-44
lines changed

1 file changed

+2
-44
lines changed

prebid/native-implementation.md

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,11 @@ According to the [OpenRTB spec](https://www.iab.com/wp-content/uploads/2018/03/O
633633

634634
When native ad is rendered prebid universal creative will attach `click` listeners on all DOM elements that have class `pb-click`. Which means it's up to the publisher to decide which DOM objects are 'clickable'.
635635

636-
Furthermore, prebid universal creative can also track if some specific asset is clicked. To enable this, publisher needs to assign custom attribute to associated DOM element: `hb_native_asset_id = "5"`. In that case if user clicks on asset with `id: 5` prebid universal creative will take `link` object from that asset and fire all click trackers. If asset doesn't have `link` object, prebid universal creative will fire all click trackers associated with 'master' `link` object (as described in openRTB specs).
636+
Furthermore, prebid universal creative can also track if some specific asset is clicked. To enable this, publisher needs to assign custom attribute to associated DOM element: `hb_native_asset_id="5"`. In that case if user clicks on asset with `id: 5` prebid universal creative will take `link` object from that asset and fire all click trackers. If asset doesn't have `link` object, prebid universal creative will fire all click trackers associated with 'master' `link` object (as described in openRTB specs).
637637

638638

639639
```html
640-
<div class="pb-click" hb_native_asset_id = "5">
640+
<div class="pb-click" hb_native_asset_id="5">
641641
```
642642
If the user clicks on this div, the Prebid Universal Creative will take the `link` object from the identified asset and fire any click trackers. If the asset doesn't have a `link` object, it will just fire the click trackers associated with 'master' `link` object.
643643

@@ -653,48 +653,6 @@ Example of how to configure a template so that the Prebid Universal Creative can
653653
</div>
654654
```
655655

656-
### 6.3. Viewability Tracking
657-
In order for viewability tracking to work, there needs to be a script on `window.top` that is tracking if the ad's iframe is viewable or not. Also, this script needs to communicate with Prebid.js so that appropriate trackers are fired when the ad is viewable.
658-
659-
To minimize needed work on the publisher side, we recommend using the [Prebid.js Viewability module](https://github.com/prebid/Prebid.js/blob/master/modules/viewability.md).
660-
661-
Enabling viewability tracking for native ads:
662-
- Build your Prebid.js bundle with the `viewability` module
663-
- Use the [Custom Renderer scenario](#43-implementing-the-custom-renderer-scenario) and add the following code to the `window.renderAd` function:
664-
665-
``` javascript
666-
window.renderAd = (bid) => {
667-
const {ortb} = bid;
668-
// code that generates the native ad based on a template and ortb response should remain the same
669-
...
670-
671-
// send post message for viewability module to track and fire appropriate trackers
672-
if (ortb.eventtrackers) {
673-
// filter for "viewable-mrc50" and "viewable-mrc100"
674-
ortb.eventtrackers.filter(ev => ev.event == 2 || ev.event == 3).forEach(tracker => {
675-
let viewabilityRecord = {
676-
vid: bid.adId,
677-
tracker: {
678-
value: tracker.url,
679-
method: tracker.method == 1 ? 'img' : 'js', // method 1: img, 2: js
680-
},
681-
criteria: {
682-
inViewThreshold: tracker.event == 2 ? 0.5 : 1.0,
683-
timeInView: 1000,
684-
},
685-
message: 'Prebid Viewability',
686-
action: 'startMeasurement',
687-
};
688-
689-
let message = JSON.stringify(viewabilityRecord);
690-
window.parent.postMessage(message, '*');
691-
})
692-
}
693-
694-
return template;
695-
}
696-
```
697-
698656
## 7. Ad Server Implementation Details
699657

700658
There are detailed [instructions for setting up native in GAM](/adops/gam-native.html), but none of the Prebid functionality is specific to GAM. The requirements to use any of these approaches in a different ad server are:

0 commit comments

Comments
 (0)