Skip to content

Commit

Permalink
Prebid 9: Move bidders iframes urls to config (#11579)
Browse files Browse the repository at this point in the history
* Prebid 9: Move bidders iframes urls to config

* removing default config

* Update config.js

---------

Co-authored-by: Marcin Komorski <marcinkomorski@Marcins-MacBook-Pro.local>
Co-authored-by: Patrick McCann <patmmccann@gmail.com>
  • Loading branch information
3 people authored Jun 3, 2024
1 parent 902a3e0 commit eec7894
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 35 deletions.
36 changes: 2 additions & 34 deletions modules/topicsFpdModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,6 @@ export function reset() {
iframeLoadedURL = [];
}

const bidderIframeList = {
maxTopicCaller: 4,
bidders: [{
bidder: 'pubmatic',
iframeURL: 'https://ads.pubmatic.com/AdServer/js/topics/topics_frame.html'
}, {
bidder: 'rtbhouse',
iframeURL: 'https://topics.authorizedvault.com/topicsapi.html'
}, {
bidder: 'openx',
iframeURL: 'https://pa.openx.net/topics_frame.html'
}, {
bidder: 'improvedigital',
iframeURL: 'https://hb.360yield.com/privacy-sandbox/topics.html'
}, {
bidder: 'onetag',
iframeURL: 'https://onetag-sys.com/static/topicsapi.html'
}, {
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'
}, {
bidder: 'undertone',
iframeURL: 'https://creative-p.undertone.com/spk-public/topics_frame.html'
}, {
bidder: 'vidazoo',
iframeURL: 'https://static.vidazoo.com/topics_api/topics_frame.html'
}]
}

export const coreStorage = getCoreStorageManager(MODULE_NAME);
export const topicStorageName = 'prebid:topics';
export const lastUpdated = 'lastUpdated';
Expand Down Expand Up @@ -161,7 +129,7 @@ export function processFpd(config, {global}, {data = topicsData} = {}) {
*/
export function getCachedTopics() {
let cachedTopicData = [];
const topics = config.getConfig('userSync.topics') || bidderIframeList;
const topics = config.getConfig('userSync.topics');
const bidderList = topics.bidders || [];
let storedSegments = new Map(safeJSONParse(coreStorage.getDataFromLocalStorage(topicStorageName)));
storedSegments && storedSegments.forEach((value, cachedBidder) => {
Expand Down Expand Up @@ -243,7 +211,7 @@ function listenMessagesFromTopicIframe() {
*/
export function loadTopicsForBidders(doc = document) {
if (!isTopicsSupported(doc)) return;
const topics = config.getConfig('userSync.topics') || bidderIframeList;
const topics = config.getConfig('userSync.topics');

if (topics) {
listenMessagesFromTopicIframe();
Expand Down
7 changes: 6 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const DEFAULT_MAXBID_VALUE = 5000

const DEFAULT_TIMEOUTBUFFER = 400;

const DEFAULT_IFRAMES_CONFIG = {};

export const RANDOM = 'random';
const FIXED = 'fixed';

Expand Down Expand Up @@ -163,7 +165,10 @@ export function newConfig() {
maxNestedIframes: DEFAULT_MAX_NESTED_IFRAMES,

// default max bid
maxBid: DEFAULT_MAXBID_VALUE
maxBid: DEFAULT_MAXBID_VALUE,
userSync: {
topics: DEFAULT_IFRAMES_CONFIG
}
};

Object.defineProperties(newConfig,
Expand Down
12 changes: 12 additions & 0 deletions test/spec/modules/topicsFpdModule_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,21 @@ describe('topics', () => {
}]]
);
storage.setDataInLocalStorage(topicStorageName, storedSegments);
config.setConfig({
userSync: {
topics: {
maxTopicCaller: 4,
bidders: [{
bidder: 'pubmatic',
iframeURL: 'https://ads.pubmatic.com/AdServer/js/topics/topics_frame.html'
}]
}
}
})
});
afterEach(() => {
sandbox.restore();
config.resetConfig();
});

it('should return segments for bidder if transmitUfpd is allowed', () => {
Expand Down

0 comments on commit eec7894

Please sign in to comment.