From 8ae414f4e44f08bf525a52d9eb02a08ff9afc3c1 Mon Sep 17 00:00:00 2001 From: steffenmllr Date: Mon, 8 Apr 2024 16:41:11 +0200 Subject: [PATCH] Adds deviceHeight and deviceWidth to request --- modules/agmaAnalyticsAdapter.js | 3 +++ test/spec/modules/agmaAnalyticsAdapter_spec.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/modules/agmaAnalyticsAdapter.js b/modules/agmaAnalyticsAdapter.js index e43dee063c5..b170806565b 100644 --- a/modules/agmaAnalyticsAdapter.js +++ b/modules/agmaAnalyticsAdapter.js @@ -127,6 +127,7 @@ export const getPayload = (auctionIds, options) => { }; if (useExtendedPayload) { + const device = config.getConfig('device') || {}; const { x, y } = getScreen(); const userIdsAsEids = getUserIDs(); payload = { @@ -141,6 +142,8 @@ export const getPayload = (auctionIds, options) => { pageUrl: ri.page, screenWidth: x, screenHeight: y, + deviceWidth: device.w || screen.width, + deviceHeight: device.h || screen.height, userIdsAsEids, }; } diff --git a/test/spec/modules/agmaAnalyticsAdapter_spec.js b/test/spec/modules/agmaAnalyticsAdapter_spec.js index ba71624e3b3..df18e7bcf45 100644 --- a/test/spec/modules/agmaAnalyticsAdapter_spec.js +++ b/test/spec/modules/agmaAnalyticsAdapter_spec.js @@ -28,6 +28,8 @@ const extendedKey = [ 'referrer', 'screenHeight', 'screenWidth', + 'deviceWidth', + 'deviceHeight', 'scriptVersion', 'timestamp', 'timezoneOffset', @@ -333,6 +335,8 @@ describe('AGMA Analytics Adapter', () => { expect(request.url).to.equal(INGEST_URL); expect(requestBody).to.have.all.keys(extendedKey); expect(requestBody.triggerEvent).to.equal(constants.EVENTS.AUCTION_INIT); + expect(requestBody.deviceWidth).to.equal(screen.width); + expect(requestBody.deviceHeight).to.equal(screen.height); expect(server.requests).to.have.length(1); expect(agmaAnalyticsAdapter.auctionIds).to.have.length(0); });