diff --git a/_includes/dev-docs/native-image-asset-sizes.md b/_includes/dev-docs/native-image-asset-sizes.md new file mode 100644 index 0000000000..99149a51e2 --- /dev/null +++ b/_includes/dev-docs/native-image-asset-sizes.md @@ -0,0 +1,35 @@ +There are two methods for defining sizes for image-like assets (`image` and `icon`). Both are shown below, but the first example (using `sizes`) is more widely supported by demand partners. + +Using `mediaTypes.native.image.sizes` (or `mediaTypes.native.icon.sizes` for icons): + +{% highlight js %} + + mediaTypes: { + native: { + image: { + required: true, + sizes: [150, 50] + } + } + } + +{% endhighlight %} + +Using `mediaTypes.native.image.aspect_ratios` (or `mediaTypes.native.icon.aspect_ratios` for icons): + +{% highlight js %} + + mediaTypes: { + native: { + image: { + required: true, + aspect_ratios: [{ + min_width: 300, /* Optional */ + ratio_width: 2, /* Required */ + ratio_height: 3, /* Required */ + }] + } + } + } + +{% endhighlight %} diff --git a/dev-docs/bidders/appnexus.md b/dev-docs/bidders/appnexus.md index 2a6ed65135..463412152b 100644 --- a/dev-docs/bidders/appnexus.md +++ b/dev-docs/bidders/appnexus.md @@ -10,19 +10,31 @@ hide: true prebid_1_0_supported : true --- -### bid params +**Table of Contents** + +- [Bid params](#appnexus-bid-params) +- [Support for publisher-defined keys](#appnexus-pub-keys) +- [Banner Ads](#appnexus-Banner) +- [Video Ads](#appnexus-Video) +- [Native Ads](#appnexus-Native) + + + +### Bid params {: .table .table-bordered .table-striped } -| Name | Scope | Description | Example | -|----------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------| -| `placementId` | required | The placement ID from AppNexus. You may identify a placement using the `invCode` and `member` instead of a placement ID. | `"234234"` | -| "arbitraryKey" | optional | This key can be *any publisher-defined string*. The value (also a string) maps to a querystring segment for enhanced buy-side targeting. Multiple key-value pairs can be added. See example below. | `'genre': 'rock'` | -| `invCode` | optional | The inventory code from AppNexus. Must be used with `member`. | `"abc123"` | -| `member` | optional | The member ID from AppNexus. Must be used with `invCode`. | `"12345"` | -| `reserve` | optional | Sets a floor price for the bid that is returned. | `0.90` | +| Name | Scope | Description | Example | +|------------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------| +| `placementId` | required | The placement ID from AppNexus. You may identify a placement using the `invCode` and `member` instead of a placement ID. | `"234234"` | +| `"arbitraryKey"` | optional | This key can be *any publisher-defined string*. The value (also a string) maps to a querystring segment for enhanced buy-side targeting. Multiple key-value pairs can be added as shown [below](#appnexus-pub-keys). | `'genre': 'rock'` | +| `invCode` | optional | The inventory code from AppNexus. Must be used with `member`. | `"abc123"` | +| `member` | optional | The member ID from AppNexus. Must be used with `invCode`. | `"12345"` | +| `reserve` | optional | Sets a floor price for the bid that is returned. | `0.90` | + + + +#### Support for publisher-defined keys -{: .alert.alert-info :} -**Support for Publisher-Defined Keys** To pass in a publisher-defined key whose value maps to a querystring segment for buy-side targeting, set up your `params` object as shown below. For more information, see the [query string targeting documentation](https://wiki.appnexus.com/x/7oCzAQ) (login required). {% highlight js %} @@ -43,4 +55,33 @@ var adUnits = [{ }] {% endhighlight %} -(Sizes set in `adUnit` object will also apply to the AppNexus bid requests.) +{: .alert.alert-info :} +Sizes set in the `adUnit` object will also apply to the AppNexus bid requests. + + + +#### Banner Ads + +AppNexus supports the banner features described in: + +- [the `adUnit` banner documentation]({{site.baseurl}}/dev-docs/publisher-api-reference.html#adUnit-banner) +- [Getting Started for Developers]({{site.baseurl}}/dev-docs/getting-started.html) + + + +#### Video Ads + +AppNexus supports the video features described in: + +- [the `adUnit` video documentation]({{site.baseurl}}/dev-docs/publisher-api-reference.html#adUnit-video). +- [Show Video Ads]({{site.baseurl}}/dev-docs/show-video-with-a-dfp-video-tag.html) +- [Show Outstream Video Ads]({{site.baseurl}}/dev-docs/show-outstream-video-ads.html) + + + +#### Native Ads + +AppNexus supports the native features described in: + +- [the `adUnit` native documentation]({{site.baseurl}}/dev-docs/publisher-api-reference.html#adUnit-native). +- [Show Native Ads]({{site.baseurl}}/dev-docs/show-native-ads.html) diff --git a/dev-docs/publisher-api-reference.md b/dev-docs/publisher-api-reference.md index 3c5ab55129..24ee427aa0 100644 --- a/dev-docs/publisher-api-reference.md +++ b/dev-docs/publisher-api-reference.md @@ -613,41 +613,44 @@ See the table below for the list of properties in the `mediaTypes` object of the For an example of a native ad unit, see below. For more detailed instructions, see [Show Native Ads]({{site.baseurl}}/dev-docs/show-native-ads.html). ```javascript -pbjs.addAdUnits({ - code: slot.code, - sizes: slot.size, - mediaTypes: { - native: { - image: { - required: true - }, - title: { - required: true, - len: 80 - }, - sponsoredBy: { - required: true - }, - clickUrl: { - required: true - }, - body: { - required: true - }, - icon: { - required: true + pbjs.addAdUnits({ + code: slot.code, + mediaTypes: { + native: { + image: { + required: true, + sizes: [150, 50] + }, + title: { + required: true, + len: 80 + }, + sponsoredBy: { + required: true + }, + clickUrl: { + required: true + }, + body: { + required: true + }, + icon: { + required: true, + sizes: [50, 50] + }, }, - }, - bids: [{ - bidder: 'appnexusAst', - params: { - placementId: '9880618' - } - }, ] - } -}) + bids: [{ + bidder: 'appnexus', + params: { + placementId: '9880618' + } + }, ] + } + }) ``` +{% include dev-docs/native-image-asset-sizes.md %} + ##### Video @@ -664,7 +667,7 @@ pbjs.addAdUnits({ }, }, bids: [{ - bidder: 'appnexusAst', + bidder: 'appnexus', params: { placementId: '9333431', video: { @@ -709,13 +712,12 @@ For an example of a banner ad unit, see below. For more detailed instructions, ```javascript pbjs.addAdUnits({ code: slot.code, - sizes: slot.size, mediaTypes: { banner: { sizes: [[300, 250], [300, 600]] }, bids: [{ - bidder: 'appnexusAst', + bidder: 'appnexus', params: { placementId: '9880618' } @@ -1168,11 +1170,11 @@ To define an alias for a bidder adapter, call this method at runtime: {% highlight js %} -pbjs.aliasBidder('appnexusAst', 'newAlias'); +pbjs.aliasBidder('appnexus', 'newAlias'); {% endhighlight %} -Defining an alias can help avoid user confusion since it's possible to send parameters to the same adapter but in different contexts (e.g, The publisher uses `"appnexusAst"` for demand and also uses `"newAlias"` which is an SSP partner that uses the `"appnexusAst"` adapter to serve their own unique demand). +Defining an alias can help avoid user confusion since it's possible to send parameters to the same adapter but in different contexts (e.g, The publisher uses `"appnexus"` for demand and also uses `"newAlias"` which is an SSP partner that uses the `"appnexus"` adapter to serve their own unique demand). It's not technically necessary to define an alias, since each copy of an adapter with the same name gets a different ID in the internal bidder registry so Prebid.js can still tell them apart. diff --git a/dev-docs/show-native-ads.md b/dev-docs/show-native-ads.md index 2942ca964a..15d631b924 100644 --- a/dev-docs/show-native-ads.md +++ b/dev-docs/show-native-ads.md @@ -15,7 +15,7 @@ nav_section: prebid-native In this tutorial, we'll set up Prebid.js to show native ads. -We'll use the [AppNexus AST adapter]({{site.github.url}}/dev-docs/bidders.html#appnexusAst) since that adapter supports native ads, but the concepts and setup will be largely the same for any bidder adapter that supports the `"native"` media type. +We'll use the [AppNexus adapter]({{site.github.url}}/dev-docs/bidders.html#appnexus) since that adapter supports native ads, but the concepts and setup will be largely the same for any bidder adapter that supports the `"native"` media type. Similarly, we'll use DFP as the ad server, but the concept and implementation should be pretty similar to other ad servers. @@ -110,11 +110,11 @@ Each key's value is an object with several fields. Most important is the `requi pbjs.addAdUnits({ code: slot.code, - sizes: slot.size, mediaTypes: { native: { image: { - required: true + required: true, + sizes: [150, 50] }, title: { required: true, @@ -130,11 +130,12 @@ pbjs.addAdUnits({ required: true }, icon: { - required: true + required: true, + sizes: [50, 50] }, }, bids: [{ - bidder: 'appnexusAst', + bidder: 'appnexus', params: { placementId: '9880618' } @@ -166,19 +167,26 @@ And the following optional fields: + icon + cta -A native `image` ad unit can be set up in the manner below: - -{% highlight js %} +A native "image-type" ad unit can be set up as shown in the following example. - const adUnits = [{ +```javascript + const adUnits = [{ code: 'adUnit-code', - mediaTypes: { native: { type: 'image' } } - bids: [ - { bidder: 'appnexusAst', params: { placementId: '123456' } } - ] - }]; + mediaTypes: { + native: { + type: 'image' + } + } + bids: [{ + bidder: 'appnexus', + params: { + placementId: '123456' + } + }] + }]; +``` -{% endhighlight %} +{% include dev-docs/native-image-asset-sizes.md %} ### 3. Add your native ad tag to the page body as usual: