Skip to content

[EXCH-10877] Add support for native to OpenX bid adapter#59

Closed
Gabriela Międlar (gmiedlar-ox) wants to merge 25 commits intomasterfrom
EXCH-10877-add-support-for-native-imps
Closed

[EXCH-10877] Add support for native to OpenX bid adapter#59
Gabriela Międlar (gmiedlar-ox) wants to merge 25 commits intomasterfrom
EXCH-10877-add-support-for-native-imps

Conversation

@gmiedlar-ox

No description provided.


function isBannerBid(bid) {
return utils.deepAccess(bid, 'mediaTypes.banner') || !isVideoBid(bid);
return utils.deepAccess(bid, 'mediaTypes.banner') || (!isVideoBid(bid) && !isNativeBid(bid));

Choose a reason for hiding this comment

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

can we move this condition (!isVideoBid(bid) && !isNativeBid(bid)) to const as this is getting less readable

// In case of multi-format bids remove `video` from mediaTypes as for video a separate bid request is built
.map(bid => ({...bid, mediaTypes: {...bid.mediaTypes, video: undefined}}));

let requests = bannerAndNativeBids.length ? [createRequest(bannerAndNativeBids, bidderRequest, undefined)] : [];

Choose a reason for hiding this comment

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

are we fine now, all of our banner bids with end up with

{
    context: {
        mediaType: undefined
    }
}

Does undefined means explicitly that is some kind of mixed? (or it can be also uknown type)

What about null rather than undefined?

Choose a reason for hiding this comment

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

Yes, undefined in this case means that this request can contain both - banner and native imps. So we cannot say what is the media type of whole bid request.
I can change it to null - it should work the same as undefined.

Comment on lines +166 to +168
let bannerAndNativeBids = bids.filter(bid => isBannerBid(bid) || isNativeBid(bid))
// In case of multi-format bids remove `video` from mediaTypes as for video a separate bid request is built
.map(bid => ({...bid, mediaTypes: {...bid.mediaTypes, video: undefined}}));

Choose a reason for hiding this comment

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

in case of this map, we dont need something similar for video?

What i do understand for multi video we will end up with
{native: [value], video: [value]} - not marking other types as undefined

Choose a reason for hiding this comment

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

Actually for video we don't need to do something similar because for each element of videoBids we specify VIDEO mediaType when we build bid request. Because of this, converter will skip all other mediaTypes (banner, native) when converting request to openRTB. So at the end we will have only video format in such bid request.
I added assertions to unit tests which verify it.

Copy link

@bukrain Rafał Sieczka (bukrain) left a comment

Choose a reason for hiding this comment

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

LGTM.
Some minor comments.

expect(requests[1].data.imp).to.have.length(1);
expect(requests[1].data.imp[0].banner).to.not.exist;
expect(requests[1].data.imp[0].native).to.not.exist;
if (FEATURES.VIDEO) {

Choose a reason for hiding this comment

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

Wondering what is FEATURES.VIDEO and FEATURES.NATIVE.
Are those if's necessary?

Choose a reason for hiding this comment

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

Our adapter utilizes ortbConverter library and there are some checks there which verifies if video/native feature is enabled.

When all tests are executed with gulp test command, test-all-features-disabled task will be executed firstly, and then test-only.
I enclosed native-related tests in this if, so that they won't be run when native feature is disabled (test-all-features-disabled). However those tests should be run in test-only task.
I've also seen similar pattern in other adapters tests: example.

Choose a reason for hiding this comment

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

That makes sense. Thanks for clarification :).

const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
expect(request[0].data.ext.platform).to.equal(bidRequestsWithMediaTypes[0].params.platform);
expect(request[1].data.ext.platform).to.equal(bidRequestsWithMediaTypes[0].params.platform);
expect(request[1].data.ext.platform).to.equal(bidRequestsWithMediaTypes[1].params.platform);

Choose a reason for hiding this comment

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

If we are changing this line, maybe it would be a good idea to give bidRequestsWithMediaTypes[1].params.platform different value than for bidRequestsWithMediaTypes[0].params.platform

Choose a reason for hiding this comment

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

Good idea. Updated, thanks!

@gmiedlar-ox
Copy link
Author

Changes were merged to upstream repo: prebid#12625

Marcin Wrobel (marcin-wrobel-ox) pushed a commit that referenced this pull request Feb 13, 2026
… time, support region, bugfixes (prebid#14374)

* AGT-734: Support region for prebid modules (merge 0_3_4 with master)

* AGT-730: move spd to partnerData (merge 0_3_4 to master)

* AGT-765: Send ad size and pos in impression reporting module (#58)

* AGT-765: pos and size

* AGT-765: Tests for position resolving

* AGT-765: Test fix

* AGT-756: Missed vrref in payload fix (#56)

* AGT-756: vrref in payload fix

* remove comment

* AGT-756: Fix vrref bug

* AGT-756: Remove comments

* AGT-756: Test for vrref

* update requestRtt to show more clear time (#59)

* AGT-739: Change time to call server (#57)

* fix typo, remove parameter duplication (#60)

* fix typo, remove parameter duplication

* update doc examples

* AGT-721: Documentation for region, size, pos (#61)

* fix region parameter in table (#62)

* update tests

* remove unused test

---------

Co-authored-by: dmytro-po <dmytro.po@intentiq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments