From 4762b1ecfce0ea02005874683285dddec85f9009 Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Tue, 17 Dec 2019 06:22:57 -0800 Subject: [PATCH] PubMatic: sending transactionId in source.tid (#4588) * added support for pubcommon, digitrust, id5id * added support for IdentityLink * changed the source for id5 * added unit test cases * changed source param for identityLink * using utils.deepSetvalue * passing transactionId in source.tid --- modules/pubmaticBidAdapter.js | 20 ++++++-------------- test/spec/modules/pubmaticBidAdapter_spec.js | 1 + 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/modules/pubmaticBidAdapter.js b/modules/pubmaticBidAdapter.js index cf4ccee17d0c..966706922672 100644 --- a/modules/pubmaticBidAdapter.js +++ b/modules/pubmaticBidAdapter.js @@ -895,6 +895,9 @@ export const spec = { payload.site.page = conf.kadpageurl.trim() || payload.site.page.trim(); payload.site.domain = _getDomainFromURL(payload.site.page); + // passing transactionId in source.tid + utils.deepSetValue(payload, 'source.tid', conf.transactionId); + // test bids if (window.location.href.indexOf('pubmaticTest=true') !== -1) { payload.test = 1; @@ -902,24 +905,13 @@ export const spec = { // adding schain object if (validBidRequests[0].schain) { - payload.source = { - ext: { - schain: validBidRequests[0].schain - } - }; + utils.deepSetValue(payload, 'source.ext.schain', validBidRequests[0].schain); } // Attaching GDPR Consent Params if (bidderRequest && bidderRequest.gdprConsent) { - payload.user.ext = { - consent: bidderRequest.gdprConsent.consentString - }; - - payload.regs = { - ext: { - gdpr: (bidderRequest.gdprConsent.gdprApplies ? 1 : 0) - } - }; + utils.deepSetValue(payload, 'user.ext.consent', bidderRequest.gdprConsent.consentString); + utils.deepSetValue(payload, 'regs.ext.gdpr', (bidderRequest.gdprConsent.gdprApplies ? 1 : 0)); } // CCPA diff --git a/test/spec/modules/pubmaticBidAdapter_spec.js b/test/spec/modules/pubmaticBidAdapter_spec.js index 85d135d9f790..902f8b1fd73c 100644 --- a/test/spec/modules/pubmaticBidAdapter_spec.js +++ b/test/spec/modules/pubmaticBidAdapter_spec.js @@ -751,6 +751,7 @@ describe('PubMatic adapter', function () { expect(data.user.geo.lon).to.equal(parseFloat(bidRequests[0].params.lon)); // Lognitude expect(data.ext.wrapper.wv).to.equal($$REPO_AND_VERSION$$); // Wrapper Version expect(data.ext.wrapper.transactionId).to.equal(bidRequests[0].transactionId); // Prebid TransactionId + expect(data.source.tid).to.equal(bidRequests[0].transactionId); // Prebid TransactionId expect(data.ext.wrapper.wiid).to.equal(bidRequests[0].params.wiid); // OpenWrap: Wrapper Impression ID expect(data.ext.wrapper.profile).to.equal(parseInt(bidRequests[0].params.profId)); // OpenWrap: Wrapper Profile ID expect(data.ext.wrapper.version).to.equal(parseInt(bidRequests[0].params.verId)); // OpenWrap: Wrapper Profile Version ID