Skip to content

Commit 8141fe9

Browse files
authored
TheMediaGrid: support ortb2.site.content.data (#8404)
1 parent 9b55a42 commit 8141fe9

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

modules/gridBidAdapter.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ export const spec = {
284284
if (genre && typeof genre === 'string') {
285285
request.site.content = {...request.site.content, genre};
286286
}
287+
const data = deepAccess(site, 'content.data');
288+
if (data && data.length) {
289+
const siteContent = request.site.content || {};
290+
request.site.content = mergeDeep(siteContent, { data });
291+
}
287292
}
288293

289294
return {

test/spec/modules/gridBidAdapter_spec.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,28 @@ describe('TheMediaGrid Adapter', function () {
569569
getConfigStub.restore();
570570
});
571571

572+
it('should have site.content.data filled from config ortb2.site.content.data', function () {
573+
const contentData = [
574+
{
575+
'name': 'someName',
576+
'ext': {
577+
'segtax': 7
578+
},
579+
'segments': [
580+
{ 'id': 'segId1' },
581+
{ 'id': 'segId2' }
582+
]
583+
}
584+
];
585+
586+
const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
587+
arg => arg === 'ortb2.site' ? { content: { data: contentData } } : null);
588+
const request = spec.buildRequests([bidRequests[0]], bidderRequest);
589+
const payload = parseRequest(request.data);
590+
expect(payload.site.content.data).to.deep.equal(contentData);
591+
getConfigStub.restore();
592+
});
593+
572594
it('should have right value in user.data when jwpsegments are present', function () {
573595
const userData = [
574596
{

0 commit comments

Comments
 (0)