Skip to content

Commit

Permalink
Adds deviceHeight and deviceWidth to request
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenmllr committed Apr 8, 2024
1 parent eac5e04 commit 8ae414f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/agmaAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const getPayload = (auctionIds, options) => {
};

if (useExtendedPayload) {
const device = config.getConfig('device') || {};
const { x, y } = getScreen();
const userIdsAsEids = getUserIDs();
payload = {
Expand All @@ -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,
};
}
Expand Down
4 changes: 4 additions & 0 deletions test/spec/modules/agmaAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const extendedKey = [
'referrer',
'screenHeight',
'screenWidth',
'deviceWidth',
'deviceHeight',
'scriptVersion',
'timestamp',
'timezoneOffset',
Expand Down Expand Up @@ -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);
});
Expand Down

0 comments on commit 8ae414f

Please sign in to comment.