Skip to content

Commit 53bc68f

Browse files
aivanov-zetaDecayConstant
authored andcommitted
pass user.geo and device.geo to payload (prebid#11723)
1 parent 19e41d9 commit 53bc68f

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

modules/zeta_global_sspBidAdapter.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ export const spec = {
147147
payload.device.w = screen.width;
148148
payload.device.h = screen.height;
149149

150+
if (bidderRequest.ortb2?.user?.geo && bidderRequest.ortb2?.device?.geo) {
151+
payload.device.geo = { ...payload.device.geo, ...bidderRequest.ortb2?.device.geo };
152+
payload.user.geo = { ...payload.user.geo, ...bidderRequest.ortb2?.user.geo };
153+
} else {
154+
if (bidderRequest.ortb2?.user?.geo) {
155+
payload.user.geo = payload.device.geo = { ...payload.user.geo, ...bidderRequest.ortb2?.user.geo };
156+
}
157+
if (bidderRequest.ortb2?.device?.geo) {
158+
payload.user.geo = payload.device.geo = { ...payload.user.geo, ...bidderRequest.ortb2?.device.geo };
159+
}
160+
}
161+
150162
if (bidderRequest?.ortb2?.device?.sua) {
151163
payload.device.sua = bidderRequest.ortb2.device.sua;
152164
}

test/spec/modules/zeta_global_sspBidAdapter_spec.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,17 @@ describe('Zeta Ssp Bid Adapter', function () {
155155
{ id: '59' }
156156
]
157157
}
158-
]
158+
],
159+
geo: {
160+
lat: 40.0,
161+
lon: -80.0,
162+
type: 2,
163+
country: 'USA',
164+
region: 'NY',
165+
metro: '501',
166+
city: 'New York',
167+
zip: '10001',
168+
}
159169
}
160170
}
161171
}];
@@ -658,12 +668,37 @@ describe('Zeta Ssp Bid Adapter', function () {
658668
expect(payload.device.sua.platform.brand).to.eql('Chrome');
659669
expect(payload.device.sua.platform.version[0]).to.eql('102');
660670

671+
// expecting the same values for user.geo and device.geo
672+
expect(payload.device.geo.type).to.eql(2);
673+
expect(payload.device.geo.lat).to.eql(40.0);
674+
expect(payload.device.geo.lon).to.eql(-80.0);
675+
expect(payload.device.geo.country).to.eql('USA');
676+
expect(payload.device.geo.region).to.eql('NY');
677+
expect(payload.device.geo.metro).to.eql('501');
678+
expect(payload.device.geo.city).to.eql('New York');
679+
expect(payload.device.geo.zip).to.eql('10001');
680+
661681
expect(payload.device.ua).to.not.be.undefined;
662682
expect(payload.device.language).to.not.be.undefined;
663683
expect(payload.device.w).to.not.be.undefined;
664684
expect(payload.device.h).to.not.be.undefined;
665685
});
666686

687+
it('Test provide user params', function () {
688+
const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
689+
const payload = JSON.parse(request.data);
690+
691+
// expecting the same values for user.geo and device.geo
692+
expect(payload.user.geo.type).to.eql(2);
693+
expect(payload.user.geo.lat).to.eql(40.0);
694+
expect(payload.user.geo.lon).to.eql(-80.0);
695+
expect(payload.user.geo.country).to.eql('USA');
696+
expect(payload.user.geo.region).to.eql('NY');
697+
expect(payload.user.geo.metro).to.eql('501');
698+
expect(payload.user.geo.city).to.eql('New York');
699+
expect(payload.user.geo.zip).to.eql('10001');
700+
});
701+
667702
it('Test that all empties are removed', function () {
668703
const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
669704
const payload = JSON.parse(request.data);

0 commit comments

Comments
 (0)