-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Unicorn bid adapter: document ad slot position signals #6674
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fdd00e3
Unicorn RTD Provider: add module documentation
harufujimoto 2a9b672
Unicorn RTD Provider docs: wrap maintainer email to satisfy markdownl…
harufujimoto b12e45c
Document UNICORN adapter position signals; drop obsolete RTD module doc
harufujimoto f7cd957
Fix markdownlint in unicorn bidder doc (heading level, compact table)
harufujimoto 950a310
Restore aligned bid-params table; sync key name to imp.ext.adslot
harufujimoto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| --- | ||
| layout: page_v2 | ||
| title: Unicorn RTD Module | ||
| display_name: Unicorn RTD Provider | ||
| description: Measures each ad slot's on-screen position and viewability before the auction and injects it into ortb2Imp | ||
| page_type: module | ||
| module_type: rtd | ||
| module_code: unicornRtdProvider | ||
| enable_download: true | ||
| sidebarType: 1 | ||
| --- | ||
|
|
||
| # Unicorn RTD Module | ||
|
|
||
| ## Overview | ||
|
|
||
| Module Name: Unicorn Rtd Provider | ||
| Module Type: Rtd Provider | ||
| Maintainer: <service+prebid.js@bulbit.jp> | ||
|
|
||
| This RTD module measures, for each ad slot, its on-screen position and | ||
| viewability (visible area ratio) on the client before the auction starts, and | ||
| injects the result into `adUnit.ortb2Imp` so it flows into the bid request. It | ||
| is intended to be used together with the Unicorn Bid Adapter, which reads the | ||
| values back and forwards them on the wire. | ||
|
|
||
| The module measures: | ||
|
|
||
| - the standard OpenRTB ad position `ortb2Imp.banner.pos`, per AdCOM 1.0 Placement Positions (2 = locked/fixed, 1 = above the fold, 3 = below the fold); | ||
| - an object `ortb2Imp.ext.data.adslot` holding the slot's visibility ratio, a sticky/fixed flag, its document-relative position and its rendered size. | ||
|
|
||
| Measurement runs once, on the animation frame after the DOM is ready, within the | ||
| configured `auctionDelay`. No page-side timing wiring is required — the publisher | ||
| just calls `requestBids()` as usual. | ||
|
|
||
| ## Integration | ||
|
|
||
| Build the module together with the RTD core and the Unicorn Bid Adapter: | ||
|
|
||
| ```bash | ||
| gulp build --modules=unicornBidAdapter,rtdModule,unicornRtdProvider | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| This module is configured as part of the `realTimeData.dataProviders` object: | ||
|
|
||
| ```javascript | ||
| pbjs.setConfig({ | ||
| realTimeData: { | ||
| auctionDelay: 300, | ||
| dataProviders: [{ | ||
| name: 'unicorn', | ||
| waitForIt: true | ||
| }] | ||
| } | ||
| }); | ||
| ``` | ||
|
|
||
| The submodule takes no `params`. | ||
|
|
||
| {: .table .table-bordered .table-striped } | ||
| | Name | Type | Description | Notes | | ||
| | :--- | :--- | :--- | :--- | | ||
| | name | String | Real time data module name | Required, always `'unicorn'` | | ||
| | waitForIt | Boolean | Wait for the module before the auction | Recommended `true` | | ||
|
|
||
| ## Slot element resolution | ||
|
|
||
| For each ad unit the module resolves the slot's DOM element id in this order: | ||
|
|
||
| 1. `ortb2Imp.ext.data.divId` — explicit override; | ||
| 2. the GPT slot mapping (`getSlotElementId`) — when the ad unit code differs from the div id; | ||
| 3. the ad unit code itself. | ||
|
|
||
| Set `ortb2Imp.ext.data.divId` when the ad unit code is not the div id and GPT is | ||
| not yet defined at auction time. | ||
|
|
||
| ## What the module injects | ||
|
|
||
| {: .table .table-bordered .table-striped } | ||
| | Field | Type | Unit / range | Meaning | | ||
| | :--- | :--- | :--- | :--- | | ||
| | `ortb2Imp.banner.pos` | int | AdCOM 1.0 Placement Position | 2 = locked (fixed), 1 = above the fold, 3 = below the fold | | ||
| | `ortb2Imp.ext.data.adslot.ver` | int | — | signal schema version (currently `1`) | | ||
| | `ortb2Imp.ext.data.adslot.ratio` | number | 0.0–1.0 | visible area ratio at measurement time | | ||
| | `ortb2Imp.ext.data.adslot.fixed` | bool | — | slot is `position: fixed` / `sticky` | | ||
| | `ortb2Imp.ext.data.adslot.x` | int | CSS px, document-relative | slot element left | | ||
| | `ortb2Imp.ext.data.adslot.y` | int | CSS px, document-relative | slot element top | | ||
| | `ortb2Imp.ext.data.adslot.w` | int | CSS px | slot element rendered width | | ||
| | `ortb2Imp.ext.data.adslot.h` | int | CSS px | slot element rendered height | | ||
|
|
||
| Coordinates are document-relative (page origin, independent of the scroll | ||
| position) and expressed in CSS pixels. | ||
|
|
||
| The Unicorn Bid Adapter forwards this object to the wire as `imp.ext.adslot`, | ||
| and the position as `imp.banner.pos`. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meta data already cover this