Skip to content

Commit

Permalink
Aso Bid Adapter: support schain (#9108)
Browse files Browse the repository at this point in the history
* SChain support

* manually kick off tests

* Inappropriate remove

* Typo fixed

* Example updated to avoid confusion

Co-authored-by: dev <dev@adsrv.org>
Co-authored-by: Chris Huie <phoenixtechnerd@gmail.com>
  • Loading branch information
3 people authored Oct 19, 2022
1 parent 0f513e7 commit c709f86
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
17 changes: 11 additions & 6 deletions modules/asoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
deepSetValue,
getDNT,
inIframe,
isArray,
isFn,
logWarn,
parseSizesInput,
Expand All @@ -19,6 +20,7 @@ const BIDDER_CODE = 'aso';
const DEFAULT_SERVER_URL = 'https://srv.aso1.net';
const DEFAULT_SERVER_PATH = '/prebid/bidder';
const OUTSTREAM_RENDERER_URL = 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js';
const VERSION = '$prebid.version$_1.1';
const TTL = 300;

export const spec = {
Expand Down Expand Up @@ -59,7 +61,7 @@ export const spec = {

serverRequests.push({
method: 'POST',
url: getEnpoint(bidRequest),
url: getEndpoint(bidRequest),
data: payload,
options: {
withCredentials: true,
Expand Down Expand Up @@ -272,11 +274,9 @@ function createVideoImp(bidRequest, videoParams) {
return imp;
}

function getEnpoint(bidRequest) {
const serverUrl = bidRequest.params.serverUrl || DEFAULT_SERVER_URL;
const serverPath = bidRequest.params.serverPath || DEFAULT_SERVER_PATH;

return serverUrl + serverPath + '?zid=' + bidRequest.params.zone + '&pbjs=$prebid.version$';
function getEndpoint(bidRequest) {
const serverUrl = bidRequest.params.server || DEFAULT_SERVER_URL;
return serverUrl + DEFAULT_SERVER_PATH + '?zid=' + bidRequest.params.zone + '&pbjs=' + VERSION;
}

function getConsentsIds(gdprConsent) {
Expand Down Expand Up @@ -341,6 +341,11 @@ function createBasePayload(bidRequest, bidderRequest) {
deepSetValue(payload, 'user.ext.eids', eids);
}

const schainData = deepAccess(bidRequest, 'schain.nodes');
if (isArray(schainData) && schainData.length > 0) {
deepSetValue(payload, 'source.ext.schain', bidRequest.schain);
}

return payload;
}

Expand Down
11 changes: 5 additions & 6 deletions modules/asoBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ For more information, please visit [Adserver.Online](https://adserver.online).

# Parameters

| Name | Scope | Description | Example | Type |
|---------------|----------|-------------------------|-----------|-----------|
| `zone` | required | Zone ID | `73815` | `Integer` |
| `attr` | optional | Custom targeting params | `{keywords: ["a", "b"]}` | `Object` |


| Name | Scope | Description | Example | Type |
|-----------|----------|-------------------------|------------------------|------------|
| `zone` | required | Zone ID | `73815` | `Integer` |
| `attr` | optional | Custom targeting params | `{foo: ["a", "b"]}` | `Object` |
| `server` | optional | Custom bidder endpoint | `https://endpoint.url` | `String` |

# Test parameters for banner
```js
Expand Down
4 changes: 2 additions & 2 deletions test/spec/modules/asoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('Adserver.Online bidding adapter', function () {
expect(parsedRequestUrl.pathname).to.equal('/prebid/bidder');

const query = parsedRequestUrl.search;
expect(query.pbjs).to.equal('$prebid.version$');
expect(query.pbjs).to.contain('$prebid.version$');
expect(query.zid).to.equal('1');

expect(request.data).to.exist;
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('Adserver.Online bidding adapter', function () {
expect(parsedRequestUrl.pathname).to.equal('/prebid/bidder');

const query = parsedRequestUrl.search;
expect(query.pbjs).to.equal('$prebid.version$');
expect(query.pbjs).to.contain('$prebid.version$');
expect(query.zid).to.equal('2');

expect(request.data).to.not.be.empty;
Expand Down

0 comments on commit c709f86

Please sign in to comment.