Skip to content

TheMediaGrid Bid Adapter: added support genre and cat from config ortb2.site #8041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions modules/gridBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,20 @@ export const spec = {
request.regs.coppa = 1;
}

const site = config.getConfig('ortb2.site');
if (site) {
const pageCategory = [...(site.cat || []), ...(site.pagecat || [])].filter((category) => {
return category && typeof category === 'string'
});
if (pageCategory.length) {
request.site.cat = pageCategory;
}
const genre = deepAccess(site, 'content.genre');
if (genre && typeof genre === 'string') {
request.site.content = {...request.site.content, genre};
}
}

return {
method: 'POST',
url: ENDPOINT_URL,
Expand Down
18 changes: 18 additions & 0 deletions test/spec/modules/gridBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,24 @@ describe('TheMediaGrid Adapter', function () {
}
];

it('should be content categories and genre', function () {
const site = {
cat: ['IAB2'],
pagecat: ['IAB2-2'],
content: {
genre: 'Adventure'
}
};

const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
arg => arg === 'ortb2.site' ? site : null);
const request = spec.buildRequests([bidRequests[0]], bidderRequest);
const payload = parseRequest(request.data);
expect(payload.site.cat).to.deep.equal([...site.cat, ...site.pagecat]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix your circleci test output, the number of failures is "too large to display in browser"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, we have fixed circleci tests

expect(payload.site.content.genre).to.deep.equal(site.content.genre);
getConfigStub.restore();
});

it('should attach valid params to the tag', function () {
const fpdUserIdVal = '0b0f84a1-1596-4165-9742-2e1a7dfac57f';
const getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage').callsFake(
Expand Down