Skip to content

Commit

Permalink
Topics Fpd Module: Add RtbHouse topics network (prebid#10107)
Browse files Browse the repository at this point in the history
* Update topicsFpdModule.md

Addition of RTB House's Topics API iframe support

* chore: make linter happy - fixing typo

* m: post-review fixes

* chore: changed domains

* chore: changed domains

* make tests happy

---------

Co-authored-by: Przemyslaw Iwanczak <przemyslaw.iwanczak@rtbhouse.com>
  • Loading branch information
2 people authored and github-ishara-chan-tung committed Jul 12, 2023
1 parent dec5b8a commit ca2c845
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
5 changes: 4 additions & 1 deletion modules/topicsFpdModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ let LOAD_TOPICS_INITIALISE = false;
const HAS_DEVICE_ACCESS = hasDeviceAccess();

const bidderIframeList = {
maxTopicCaller: 1,
maxTopicCaller: 2,
bidders: [{
bidder: 'pubmatic',
iframeURL: 'https://ads.pubmatic.com/AdServer/js/topics/topics_frame.html'
}, {
bidder: 'rtbhouse',
iframeURL: 'https://topics.authorizedvault.com/topicsapi.html'
}]
}
export const coreStorage = getCoreStorageManager(MODULE_NAME);
Expand Down
4 changes: 4 additions & 0 deletions modules/topicsFpdModule.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ pbjs.setConfig({
bidder: 'pubmatic',
iframeURL: 'https://ads.pubmatic.com/AdServer/js/topics/topics_frame.html',
expiry: 7 // Configurable expiry days
},{
bidder: 'rtbhouse',
iframeURL: 'https://topics.authorizedvault.com/topicsapi.html',
expiry: 7 // Configurable expiry days
},{
bidder: 'rubicon',
iframeURL: 'https://rubicon.com:8080/topics/fpd/topic.html', // dummy URL
Expand Down
14 changes: 10 additions & 4 deletions test/spec/modules/topicsFpdModule_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,16 @@ describe('getCachedTopics()', () => {
}
];

const evt = {
const evt_pm = {
data: '{"segment":{"domain":"ads.pubmatic.com","topics":[{"configVersion":"chrome.1","modelVersion":"2206021246","taxonomyVersion":"1","topic":165,"version":"chrome.1:1:2206021246"}],"bidder":"pubmatic"},"date":1669743901858}',
origin: 'https://ads.pubmatic.com'
};

const evt_rh = {
data: '{"segment":{"domain":"topics.authorizedvault.com","topics":[{"configVersion":"chrome.1","modelVersion":"2206021246","taxonomyVersion":"1","topic":165,"version":"chrome.1:1:2206021246"}],"bidder":"rtbhouse"},"date":1669743901858}',
origin: 'https://topics.authorizedvault.com'
};

let gdprDataHdlrStub;
beforeEach(() => {
gdprDataHdlrStub = sinon.stub(gdprDataHandler, 'getConsentData');
Expand Down Expand Up @@ -413,9 +418,10 @@ describe('getCachedTopics()', () => {
it('should stored segments if receiveMessage event is triggerred with segment data', () => {
return processFpd({}, {global: {}}, {data: Promise.resolve(mockData)})
.then(({global}) => {
receiveMessage(evt);
receiveMessage(evt_pm);
receiveMessage(evt_rh);
let segments = new Map(safeJSONParse(storage.getDataFromLocalStorage(topicStorageName)));
expect(segments.has('pubmatic')).to.equal(true);
expect(segments.has('pubmatic') || segments.has('rtbhouse')).to.equal(true);
});
});

Expand All @@ -424,7 +430,7 @@ describe('getCachedTopics()', () => {
storage.setDataInLocalStorage(topicStorageName, storedSegments);
return processFpd({}, {global: {}}, {data: Promise.resolve(mockData)})
.then(({global}) => {
receiveMessage(evt);
receiveMessage(evt_pm);
let segments = new Map(safeJSONParse(storage.getDataFromLocalStorage(topicStorageName)));
expect(segments.get('pubmatic')[2206021246].segment.length).to.equal(1);
});
Expand Down

0 comments on commit ca2c845

Please sign in to comment.