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

Yahoo SSP adapter support for extra site publisher info. #9921

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions modules/yahoosspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ function appendFirstPartyData(outBoundBidRequest, bid) {
const ortb2Object = bid.ortb2;
const siteObject = deepAccess(ortb2Object, 'site') || undefined;
const siteContentObject = deepAccess(siteObject, 'content') || undefined;
const sitePublisherObject = deepAccess(siteObject, 'publisher') || undefined;
const siteContentDataArray = deepAccess(siteObject, 'content.data') || undefined;
const appContentObject = deepAccess(ortb2Object, 'app.content') || undefined;
const appContentDataArray = deepAccess(ortb2Object, 'app.content.data') || undefined;
Expand All @@ -394,6 +395,11 @@ function appendFirstPartyData(outBoundBidRequest, bid) {
outBoundBidRequest.site = validateAppendObject('object', allowedSiteObjectKeys, siteObject, outBoundBidRequest.site);
};

if (sitePublisherObject && isPlainObject(sitePublisherObject)) {
const allowedPublisherObjectKeys = ['ext'];
outBoundBidRequest.site.publisher = validateAppendObject('object', allowedPublisherObjectKeys, sitePublisherObject, outBoundBidRequest.site.publisher);
}

if (siteContentObject && isPlainObject(siteContentObject)) {
const allowedContentStringKeys = ['id', 'title', 'series', 'season', 'genre', 'contentrating', 'language'];
const allowedContentNumberkeys = ['episode', 'prodq', 'context', 'livestream', 'len'];
Expand Down
61 changes: 60 additions & 1 deletion test/spec/modules/yahoosspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,23 @@ describe('YahooSSP Bid Adapter:', () => {
});
});

const VALID_PUBLISHER_OBJECTS = ['ext'];
VALID_PUBLISHER_OBJECTS.forEach(param => {
it(`should determine that the ortb2.site.publisher Object key is valid and append to the bid-request: ${JSON.stringify(param)}`, () => {
const ortb2 = {
site: {
publisher: {
[param]: {a: '123', b: '456'}
}
}
};
const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.publisher[param]).to.be.a('object');
expect(data.site.publisher[param]).to.be.equal(ortb2.site.publisher[param]);
});
});

const VALID_CONTENT_ARRAYS = ['cat'];
VALID_CONTENT_ARRAYS.forEach(param => {
it(`should determine that the ortb2.site Array key is valid and append to the bid-request: ${JSON.stringify(param)}`, () => {
Expand Down Expand Up @@ -512,7 +529,6 @@ describe('YahooSSP Bid Adapter:', () => {
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.content[param]).to.be.a('object');
expect(data.site.content[param]).to.be.equal(ortb2.site.content[param]);
config.setConfig({ortb2: {}});
});
});
});
Expand Down Expand Up @@ -959,6 +975,49 @@ describe('YahooSSP Bid Adapter:', () => {
expect(data.site.id).to.equal('1234567');
});

it('should use site publisher ortb2 config in default integration mode', () => {
const ortb2 = {
site: {
publisher: {
ext: {
publisherblob: 'pblob',
bucket: 'bucket'
}
}
}
}
let { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest).data;
expect(data.site.publisher).to.deep.equal({
ext: {
publisherblob: 'pblob',
bucket: 'bucket'
}
});
});

it('should use site publisher ortb2 config when using "pubId" integration mode', () => {
const ortb2 = {
site: {
publisher: {
ext: {
publisherblob: 'pblob',
bucket: 'bucket'
}
}
}
}
let { validBidRequests, bidderRequest } = generateBuildRequestMock({pubIdMode: true, ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest).data;
expect(data.site.publisher).to.deep.equal({
id: DEFAULT_PUBID,
ext: {
publisherblob: 'pblob',
bucket: 'bucket'
}
});
});

it('should use placementId value as imp.tagid in the outbound bid-request when using "pubId" integration mode', () => {
let { validBidRequests, bidderRequest } = generateBuildRequestMock({pubIdMode: true});
validBidRequests[0].params.placementId = 'header-300x250';
Expand Down