Skip to content

Commit

Permalink
IX Bid Adapter: Remove Roundel Alias (#11732)
Browse files Browse the repository at this point in the history
* pass user.geo and device.geo to payload (#11723)

* chore: removed roundel alias [PB-3025]

---------

Co-authored-by: aivanov-zeta <144369215+aivanov-zeta@users.noreply.github.com>
Co-authored-by: Love Sharma <love.sharma@indexexchange.com>
  • Loading branch information
3 people authored Jun 7, 2024
1 parent 462ee4f commit aabca94
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 40 deletions.
11 changes: 0 additions & 11 deletions modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { Renderer } from '../src/Renderer.js';
import {getGptSlotInfoForAdUnitCode} from '../libraries/gptUtils/gptUtils.js';

const BIDDER_CODE = 'ix';
const ALIAS_BIDDER_CODE = 'roundel';
const GLOBAL_VENDOR_ID = 10;
const SECURE_BID_URL = 'https://htlb.casalemedia.com/openrtb/pbjs';
const SUPPORTED_AD_TYPES = [BANNER, VIDEO, NATIVE];
Expand Down Expand Up @@ -695,11 +694,6 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
addRTI(userEids, eidInfo);
}

// If `roundel` alias bidder, only send requests if liveramp ids exist.
if (bidderRequest && bidderRequest.bidderCode === ALIAS_BIDDER_CODE && !eidInfo.seenSources['liveramp.com']) {
return [];
}

const requests = [];
let r = createRequest(validBidRequests);

Expand Down Expand Up @@ -1606,11 +1600,6 @@ export const spec = {

code: BIDDER_CODE,
gvlid: GLOBAL_VENDOR_ID,
aliases: [{
code: ALIAS_BIDDER_CODE,
gvlid: GLOBAL_VENDOR_ID,
skipPbsAliasing: false
}],
supportedMediaTypes: SUPPORTED_AD_TYPES,

/**
Expand Down
12 changes: 12 additions & 0 deletions modules/zeta_global_sspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ export const spec = {
payload.device.w = screen.width;
payload.device.h = screen.height;

if (bidderRequest.ortb2?.user?.geo && bidderRequest.ortb2?.device?.geo) {
payload.device.geo = { ...payload.device.geo, ...bidderRequest.ortb2?.device.geo };
payload.user.geo = { ...payload.user.geo, ...bidderRequest.ortb2?.user.geo };
} else {
if (bidderRequest.ortb2?.user?.geo) {
payload.user.geo = payload.device.geo = { ...payload.user.geo, ...bidderRequest.ortb2?.user.geo };
}
if (bidderRequest.ortb2?.device?.geo) {
payload.user.geo = payload.device.geo = { ...payload.user.geo, ...bidderRequest.ortb2?.device.geo };
}
}

if (bidderRequest?.ortb2?.device?.sua) {
payload.device.sua = bidderRequest.ortb2.device.sua;
}
Expand Down
28 changes: 0 additions & 28 deletions test/spec/modules/ixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1351,34 +1351,6 @@ describe('IndexexchangeAdapter', function () {
});
});

describe('Roundel alias adapter', function () {
const vaildBids = [DEFAULT_BANNER_VALID_BID, DEFAULT_VIDEO_VALID_BID, DEFAULT_MULTIFORMAT_BANNER_VALID_BID, DEFAULT_MULTIFORMAT_VIDEO_VALID_BID];
const ALIAS_OPTIONS = Object.assign({
bidderCode: 'roundel'
}, DEFAULT_OPTION);

it('should not build requests for mediaTypes if liveramp data is unavaliable', function () {
vaildBids.forEach((validBid) => {
const request = spec.buildRequests(validBid, ALIAS_OPTIONS);
expect(request).to.be.an('array');
expect(request).to.have.lengthOf(0);
});
});

it('should build requests for mediaTypes if liveramp data is avaliable', function () {
vaildBids.forEach((validBid) => {
const cloneValidBid = utils.deepClone(validBid);
cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
const request = spec.buildRequests(cloneValidBid, ALIAS_OPTIONS);
const payload = extractPayload(request[0]);
expect(request).to.be.an('array');
expect(request).to.have.lengthOf.above(0); // should be 1 or more
expect(payload.user.eids).to.have.lengthOf(11);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
});
});
});

describe('buildRequestsIdentity', function () {
let request;
let payload;
Expand Down
37 changes: 36 additions & 1 deletion test/spec/modules/zeta_global_sspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,17 @@ describe('Zeta Ssp Bid Adapter', function () {
{ id: '59' }
]
}
]
],
geo: {
lat: 40.0,
lon: -80.0,
type: 2,
country: 'USA',
region: 'NY',
metro: '501',
city: 'New York',
zip: '10001',
}
}
}
}];
Expand Down Expand Up @@ -658,12 +668,37 @@ describe('Zeta Ssp Bid Adapter', function () {
expect(payload.device.sua.platform.brand).to.eql('Chrome');
expect(payload.device.sua.platform.version[0]).to.eql('102');

// expecting the same values for user.geo and device.geo
expect(payload.device.geo.type).to.eql(2);
expect(payload.device.geo.lat).to.eql(40.0);
expect(payload.device.geo.lon).to.eql(-80.0);
expect(payload.device.geo.country).to.eql('USA');
expect(payload.device.geo.region).to.eql('NY');
expect(payload.device.geo.metro).to.eql('501');
expect(payload.device.geo.city).to.eql('New York');
expect(payload.device.geo.zip).to.eql('10001');

expect(payload.device.ua).to.not.be.undefined;
expect(payload.device.language).to.not.be.undefined;
expect(payload.device.w).to.not.be.undefined;
expect(payload.device.h).to.not.be.undefined;
});

it('Test provide user params', function () {
const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
const payload = JSON.parse(request.data);

// expecting the same values for user.geo and device.geo
expect(payload.user.geo.type).to.eql(2);
expect(payload.user.geo.lat).to.eql(40.0);
expect(payload.user.geo.lon).to.eql(-80.0);
expect(payload.user.geo.country).to.eql('USA');
expect(payload.user.geo.region).to.eql('NY');
expect(payload.user.geo.metro).to.eql('501');
expect(payload.user.geo.city).to.eql('New York');
expect(payload.user.geo.zip).to.eql('10001');
});

it('Test that all empties are removed', function () {
const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
const payload = JSON.parse(request.data);
Expand Down

0 comments on commit aabca94

Please sign in to comment.