Skip to content

Commit

Permalink
Gumgum Bid Adapter: add local time and timezone offset in requests (p…
Browse files Browse the repository at this point in the history
…rebid#7587)

* Gumgum: ADTS-164 Send local time and timezone offset in ad requests

* object existence check before accessing property
  • Loading branch information
lbenmore authored Oct 20, 2021
1 parent 26599cf commit fdfe85e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,14 @@ function buildRequests(validBidRequests, bidderRequest) {
let data = {};
let gpid = '';

const date = new Date();
const lt = date && date.getTime();
const to = date && date.getTimezoneOffset();
if (to) {
lt && (data.lt = lt);
data.to = to;
}

// ADTS-134 Retrieve ID envelopes
for (const eid in eids) data[eid] = eids[eid];

Expand Down
6 changes: 5 additions & 1 deletion test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,13 @@ describe('gumgumAdapter', function () {
const jcsi = JSON.stringify(JCSI);
const bidRequest = spec.buildRequests(bidRequests)[0];
const actualKeys = Object.keys(JSON.parse(bidRequest.data.jcsi)).sort();
expect(actualKeys).to.eq(actualKeys);
expect(actualKeys).to.eql(expectedKeys);
expect(bidRequest.data.jcsi).to.eq(jcsi);
});
it('should include the local time and timezone offset', function () {
const bidRequest = spec.buildRequests(bidRequests)[0];
expect(!!bidRequest.data.lt).to.be.true;
});
})

describe('interpretResponse', function () {
Expand Down

0 comments on commit fdfe85e

Please sign in to comment.