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

Aso Bid Adapter: support schain #9108

Merged
merged 6 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
19 changes: 15 additions & 4 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,8 +20,15 @@ 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;

/*
* In case you're Adserver.Online platform's client who needs a branded adapter,
* WE KINDLY ASK YOU DO NOT COPY THIS ADAPTER UNDER NEW NAME!
adserver-online marked this conversation as resolved.
Show resolved Hide resolved
* Please get in touch with support@adsrv.org, and we'll add your adapter as an alias.
*/

export const spec = {

code: BIDDER_CODE,
Expand Down Expand Up @@ -273,10 +281,8 @@ function createVideoImp(bidRequest, videoParams) {
}

function getEnpoint(bidRequest) {
const serverUrl = bidRequest.params.serverUrl || DEFAULT_SERVER_URL;
adserver-online marked this conversation as resolved.
Show resolved Hide resolved
const serverPath = bidRequest.params.serverPath || DEFAULT_SERVER_PATH;

return serverUrl + serverPath + '?zid=' + bidRequest.params.zone + '&pbjs=$prebid.version$';
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 +347,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 | `{keywords: ["a", "b"]}` | `Object` |
adserver-online marked this conversation as resolved.
Show resolved Hide resolved
| `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