Skip to content

Commit

Permalink
update to copy site.page and site.publisher.id if not defined in conf…
Browse files Browse the repository at this point in the history
…ig site object
  • Loading branch information
idettman committed Jun 4, 2020
1 parent bc46220 commit 44640e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
12 changes: 9 additions & 3 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,17 @@ function _appendSiteAppDevice(request, pageUrl) {
request.app.publisher = {id: _s2sConfig.accountId}
} else {
request.site = {};
if (typeof config.getConfig('site') === 'object') {
if (utils.isPlainObject(config.getConfig('site'))) {
request.site = config.getConfig('site');
}
utils.deepSetValue(request.site, 'publisher.id', _s2sConfig.accountId);
request.site.page = pageUrl;
// set publisher.id if not already defined
if (!utils.deepAccess(request.site, 'publisher.id')) {
utils.deepSetValue(request.site, 'publisher.id', _s2sConfig.accountId);
}
// set site.page if not already defined
if (!request.site.page) {
request.site.page = pageUrl;
}
}
if (typeof config.getConfig('device') === 'object') {
request.device = config.getConfig('device');
Expand Down
8 changes: 0 additions & 8 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,6 @@ export function newConfig() {
set disableAjaxTimeout(val) {
this._disableAjaxTimeout = val;
},

_site: undefined,
get site() {
return this._site;
},
set site(val) {
this._site = val;
}
};

if (config) {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ describe('S2S Adapter', function () {
expect(requestBid.site.content.language).to.exist.and.to.be.a('string');
expect(requestBid.site).to.deep.equal({
publisher: {
id: '1',
id: '1234',
domain: 'test.com'
},
content: {
Expand Down

0 comments on commit 44640e3

Please sign in to comment.