From 6d349412c18dbd1d93a136e7683cda10ca1644b6 Mon Sep 17 00:00:00 2001 From: tudou <42998776+lhxx121@users.noreply.github.com> Date: Wed, 20 Mar 2024 05:15:08 +0800 Subject: [PATCH] Discovery Bid Adapter : support topics (#11209) * Discovery Bid Adapter : add title, desc, keywords, hLen, nbw, hc, dm add unit test resolve conflict * Discovery Bid Adapter : add title, desc, keywords, hLen, nbw, hc, dm add unit test * Discovery Bid Adapter : synchronize mguid from third party cookie to first party cookie * test * Discovery Bid Adapter : Extend the expiration time of pmguid * Discovery Bid Adapter : Extend the expiration time of pmguid * Discovery Bid Adapter : Extend the expiration time of pmguid * Discovery Bid Adapter : Extend the expiration time of pmguid * Discovery Bid Adapter : support topics * Discovery Bid Adapter : support topics * Discovery Bid Adapter : support topics * Discovery Bid Adapter : support topics --------- Co-authored-by: lvhuixin --- modules/discoveryBidAdapter.js | 2 ++ modules/topicsFpdModule.js | 3 +++ modules/topicsFpdModule.md | 4 ++++ test/spec/modules/discoveryBidAdapter_spec.js | 23 +++++++++++++++++++ 4 files changed, 32 insertions(+) diff --git a/modules/discoveryBidAdapter.js b/modules/discoveryBidAdapter.js index aa497b99d00..de2fd3c3a94 100644 --- a/modules/discoveryBidAdapter.js +++ b/modules/discoveryBidAdapter.js @@ -437,6 +437,7 @@ function getParam(validBidRequests, bidderRequest) { const page = utils.deepAccess(bidderRequest, 'refererInfo.page'); const referer = utils.deepAccess(bidderRequest, 'refererInfo.ref'); const firstPartyData = bidderRequest.ortb2; + const tpData = utils.deepAccess(bidderRequest, 'ortb2.user.data') || undefined; const topWindow = window.top; const title = getPageTitle(); const desc = getPageDescription(); @@ -463,6 +464,7 @@ function getParam(validBidRequests, bidderRequest) { firstPartyData, ssppid: storage.getCookie(COOKIE_KEY_SSPPID) || undefined, pmguid: getPmgUID(), + tpData, page: { title: title ? title.slice(0, 100) : undefined, desc: desc ? desc.slice(0, 300) : undefined, diff --git a/modules/topicsFpdModule.js b/modules/topicsFpdModule.js index 748242142c4..715f1ca735a 100644 --- a/modules/topicsFpdModule.js +++ b/modules/topicsFpdModule.js @@ -41,6 +41,9 @@ const bidderIframeList = { }, { bidder: 'taboola', iframeURL: 'https://cdn.taboola.com/libtrc/static/topics/taboola-prebid-browsing-topics.html' + }, { + bidder: 'discovery', + iframeURL: 'https://api.popin.cc/topic/prebid-topics-frame.html' }] } diff --git a/modules/topicsFpdModule.md b/modules/topicsFpdModule.md index e8daded4439..8ebddacf613 100644 --- a/modules/topicsFpdModule.md +++ b/modules/topicsFpdModule.md @@ -60,6 +60,10 @@ pbjs.setConfig({ bidder: 'taboola', iframeURL: 'https://cdn.taboola.com/libtrc/static/topics/taboola-prebid-browsing-topics.html', expiry: 7 // Configurable expiry days + }, { + bidder: 'discovery', + iframeURL: 'https://api.popin.cc/topic/prebid-topics-frame.html', + expiry: 7 // Configurable expiry days }] } .... diff --git a/test/spec/modules/discoveryBidAdapter_spec.js b/test/spec/modules/discoveryBidAdapter_spec.js index 4fb4c29b99b..f1475ec3739 100644 --- a/test/spec/modules/discoveryBidAdapter_spec.js +++ b/test/spec/modules/discoveryBidAdapter_spec.js @@ -88,6 +88,22 @@ describe('discovery:BidAdapterTests', function () { bidderWinsCount: 0, }, ], + ortb2: { + user: { + data: { + segment: [ + { + id: '412' + } + ], + name: 'test.popin.cc', + ext: { + segclass: '1', + segtax: 503 + } + } + } + } }; let request = []; @@ -189,6 +205,13 @@ describe('discovery:BidAdapterTests', function () { let req_data = JSON.parse(request.data); expect(req_data.imp).to.have.lengthOf(1); }); + describe('first party data', function () { + it('should pass additional parameter in request for topics', function () { + const request = spec.buildRequests(bidRequestData.bids, bidRequestData); + let res = JSON.parse(request.data); + expect(res.ext.tpData).to.deep.equal(bidRequestData.ortb2.user.data); + }); + }); describe('discovery: buildRequests', function() { describe('getPmgUID function', function() {