diff --git a/modules/eplanningBidAdapter.js b/modules/eplanningBidAdapter.js index dfc5f514cf3..6ead42d4b2d 100644 --- a/modules/eplanningBidAdapter.js +++ b/modules/eplanningBidAdapter.js @@ -17,6 +17,7 @@ export const spec = { isBidRequestValid: function(bid) { return Boolean(bid.params.ci) || Boolean(bid.params.t); }, + buildRequests: function(bidRequests) { const method = 'GET'; const dfpClientId = '1'; @@ -24,6 +25,7 @@ export const spec = { let url; let params; const urlConfig = getUrlConfig(bidRequests); + const pcrs = getCharset(); if (urlConfig.t) { url = urlConfig.isv + '/layers/t_pbjs_2.json'; @@ -40,6 +42,11 @@ export const spec = { pbv: '$prebid.version$', ncb: '1' }; + + if (pcrs) { + params.crs = pcrs; + } + if (referrerUrl) { params.fr = referrerUrl; } @@ -147,6 +154,15 @@ function getSpacesString(bids) { return spacesString; } + +function getCharset() { + try { + return window.top.document.charset || window.top.document.characterSet; + } catch (e) { + return document.charset || document.characterSet; + } +} + function getBidIdMap(bidRequests) { let map = {}; bidRequests.forEach(bid => map[cleanName(bid.adUnitCode)] = bid.bidId); diff --git a/test/spec/modules/eplanningBidAdapter_spec.js b/test/spec/modules/eplanningBidAdapter_spec.js index 68b9e1b263f..a56bff42285 100644 --- a/test/spec/modules/eplanningBidAdapter_spec.js +++ b/test/spec/modules/eplanningBidAdapter_spec.js @@ -259,6 +259,19 @@ describe('E-Planning Adapter', () => { stubGetReferrer.restore() }); + it('should return crs parameter with document charset', () => { + let expected; + try { + expected = window.top.document.characterSet; + } catch (e) { + expected = document.characterSet; + } + + const chset = spec.buildRequests(bidRequests).data.crs; + + expect(chset).to.equal(expected); + }); + it('should return the testing url when the request has the t parameter', () => { const url = spec.buildRequests([testBid]).url; const expectedUrl = '//' + TEST_ISV + '/layers/t_pbjs_2.json';