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

Teads Bid Adapter : add more device information to payload #11316

Merged
merged 1 commit into from
Apr 11, 2024
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
2 changes: 2 additions & 0 deletions modules/teadsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export const spec = {
timeToFirstByte: getTimeToFirstByte(window),
data: bids,
deviceWidth: screen.width,
deviceHeight: screen.height,
devicePixelRatio: topWindow.devicePixelRatio,
screenOrientation: screen.orientation?.type,
historyLength: topWindow.history?.length,
viewportHeight: topWindow.visualViewport?.height,
Expand Down
35 changes: 35 additions & 0 deletions test/spec/modules/teadsBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,33 @@ describe('teadsBidAdapter', () => {
expect(payload.pageReferrer).to.deep.equal(document.referrer);
});

it('should add width info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderRequestDefault);
const payload = JSON.parse(request.data);
const deviceWidth = screen.width

expect(payload.deviceWidth).to.exist;
expect(payload.deviceWidth).to.deep.equal(deviceWidth);
});

it('should add height info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderRequestDefault);
const payload = JSON.parse(request.data);
const deviceHeight = screen.height

expect(payload.deviceHeight).to.exist;
expect(payload.deviceHeight).to.deep.equal(deviceHeight);
});

it('should add pixelRatio info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderRequestDefault);
const payload = JSON.parse(request.data);
const pixelRatio = window.top.devicePixelRatio

expect(payload.devicePixelRatio).to.exist;
expect(payload.devicePixelRatio).to.deep.equal(pixelRatio);
});

it('should add screenOrientation info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderRequestDefault);
const payload = JSON.parse(request.data);
Expand Down Expand Up @@ -290,6 +317,14 @@ describe('teadsBidAdapter', () => {
expect(payload.viewportWidth).to.deep.equal(window.top.visualViewport.width);
});

it('should add viewportHeight info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderRequestDefault);
const payload = JSON.parse(request.data);

expect(payload.viewportHeight).to.exist;
expect(payload.viewportHeight).to.deep.equal(window.top.visualViewport.height);
});

it('should add hardwareConcurrency info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderRequestDefault);
const payload = JSON.parse(request.data);
Expand Down