Skip to content
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

AppNexus Bid Adapter: Add support for 'video' in custom Native fields #12345

Merged
merged 1 commit into from
Oct 25, 2024
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
1 change: 1 addition & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ function newBid(serverBid, rtbBid, bidderRequest) {

// Custom fields
bid[NATIVE].ext = {
video: nativeAd.video,
customImage1: nativeAd.image1 && {
url: nativeAd.image1.url,
height: nativeAd.image1.height,
Expand Down
6 changes: 6 additions & 0 deletions test/spec/modules/appnexusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2085,6 +2085,8 @@ describe('AppNexusAdapter', function () {
expect(result[0].native.body2).to.equal('Additional body text');
expect(result[0].native.cta).to.equal('Do it');
expect(result[0].native.image.url).to.equal('https://cdn.adnxs.com/img.png');
// Video is technically not a base Prebid native field, so it should be included as part of the ext
// But it's also included here for backwards compatibility if people read the bid directly
expect(result[0].native.video.content).to.equal('<?xml version=\"1.0\"></xml>');
});

Expand All @@ -2093,6 +2095,7 @@ describe('AppNexusAdapter', function () {
response1.tags[0].ads[0].ad_type = 'native';
response1.tags[0].ads[0].rtb.native = {
...BASE_NATIVE,
// 'video' is included in base native
'title1': 'Custom Title 1',
'title2': 'Custom Title 2',
'title3': 'Custom Title 3',
Expand Down Expand Up @@ -2204,6 +2207,9 @@ describe('AppNexusAdapter', function () {

let result = spec.interpretResponse({ body: response1 }, { bidderRequest });
expect(result[0].native.ext).to.deep.equal({
'video': {
'content': '<?xml version=\"1.0\"></xml>'
},
'customTitle1': 'Custom Title 1',
'customTitle2': 'Custom Title 2',
'customTitle3': 'Custom Title 3',
Expand Down