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

Improve Digital adapter: support schain #4286

Merged
merged 1 commit into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 9 additions & 1 deletion modules/improvedigitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BANNER, NATIVE } from '../src/mediaTypes';
const BIDDER_CODE = 'improvedigital';

export const spec = {
version: '5.2.0',
version: '5.3.0',
code: BIDDER_CODE,
aliases: ['id'],
supportedMediaTypes: [BANNER, NATIVE],
Expand Down Expand Up @@ -47,6 +47,8 @@ export const spec = {
requestParameters.referrer = bidderRequest.refererInfo.referer;
}

requestParameters.schain = bidRequests[0].schain;

let requestObj = idClient.createRequest(
normalizedBids, // requestObject
requestParameters
Expand Down Expand Up @@ -483,6 +485,9 @@ export function ImproveDigitalAdServerJSClient(endPoint) {
if (requestParameters.gdpr || requestParameters.gdpr === 0) {
impressionBidRequestObject.gdpr = requestParameters.gdpr;
}
if (requestParameters.schain) {
impressionBidRequestObject.schain = requestParameters.schain;
}
if (extraRequestParameters) {
for (let prop in extraRequestParameters) {
impressionBidRequestObject[prop] = extraRequestParameters[prop];
Expand All @@ -502,6 +507,9 @@ export function ImproveDigitalAdServerJSClient(endPoint) {
} else {
impressionObject.id = utils.getUniqueIdentifierStr();
}
if (placementObject.adTypes) {
impressionObject.ad_types = placementObject.adTypes;
}
if (placementObject.adUnitId) {
outputObject.adUnitId = placementObject.adUnitId;
}
Expand Down
9 changes: 9 additions & 0 deletions test/spec/modules/improvedigitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ describe('Improve Digital Adapter Tests', function () {
expect(params.bid_request.referrer).to.equal('https://blah.com/test.html');
});

it('should add schain', function () {
const schain = '{"ver":"1.0","complete":1,"nodes":[{"asi":"headerlift.com","sid":"xyz","hp":1}]}';
const bidRequest = Object.assign({}, simpleBidRequest);
bidRequest.schain = schain;
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
expect(params.bid_request.schain).to.equal(schain);
});

it('should return 2 requests', function () {
const requests = spec.buildRequests([
simpleBidRequest,
Expand Down