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

Connatix Bid Adapter: Support For Video Media Type #11933

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
9e072e1
upgrade prebid js
rares-mihai-preda Apr 19, 2022
6f50479
added conversantBidAdapter
rares-mihai-preda May 18, 2022
0f6d62b
added criteoBidAdapter, tripleliftBidAdapter, pulsepointBidAdapter
DarianAvasan May 26, 2022
dd2c7ac
adtelligent bid adapter
alex-calauz-cnx Jun 15, 2022
f29a909
remove oneVideoBidAdapter from modules.json
rares-mihai-preda Jul 8, 2022
dddb048
added yieldmo bid adapter
alex-calauz-cnx Sep 5, 2022
6a5216b
build:connatix script
rares-mihai-preda Sep 14, 2022
ed403f5
Merge tag 'tags/7.16.0' into connatix
DarianAvasan Sep 20, 2022
05e6574
removed flocIdSystem & TrustxBidAdapter from modules.json
DarianAvasan Sep 20, 2022
2aa4bbf
Merge tag 'tags/7.17.0' into connatix
DarianAvasan Sep 28, 2022
8596001
added aniview bid adapter
DarianAvasan Sep 28, 2022
a13f36f
moved line
DarianAvasan Sep 28, 2022
db61e6b
added nextMillennium adapter to modules.json
Alex404Damsa Sep 30, 2022
c732da1
newline at the end of the file
rares-mihai-preda Sep 30, 2022
affb40e
added new adapters
Alex404Damsa Oct 3, 2022
f235695
Merge branch 'connatix' of https://github.com/Connatix/Prebid.js into…
Alex404Damsa Oct 3, 2022
ac53dff
added minutemedia adapter
Alex404Damsa Nov 18, 2022
d87cb0d
added richaudience adapter
DarianAvasan Nov 22, 2022
ec5a7dd
Revert "added richaudience adapter"
DarianAvasan Dec 5, 2022
9ff7b45
Revert "added minutemedia adapter"
Alex404Damsa Dec 12, 2022
e2a6dc8
Added Permutive RTD module
cosminser Jan 6, 2023
a0839a9
comma
cosminser Jan 6, 2023
e3d78dc
[feat] add sharethroughBidAdapter
Dan-Lucian Mar 21, 2023
4deb938
added insticator bid adapter
Alex404Damsa May 15, 2023
962dd2c
Merge tag 'tags/7.54.0' into connatix
cristisilav Jun 27, 2023
f583ade
Add consentManagementGpp module
cristisilav Jun 30, 2023
24f64b3
fix gpp signal (#5)
mariusszabo Jul 3, 2023
ccc92f5
remove gpp module because no need to support it yet
mariusszabo Jul 3, 2023
1236ebd
LiveRamp submodule identityLink
DarianAvasan Jul 20, 2023
f84c4b8
added sonobi bid adapter
alex-calauz-cnx Sep 12, 2023
2accd37
Merge tag 'tags/8.17.0' into connatix
rares-mihai-preda Oct 3, 2023
2d4c628
upgrade to prebid 8.17.0
rares-mihai-preda Oct 3, 2023
5ef2cfa
upgrade to prebid 8.17.0
rares-mihai-preda Oct 3, 2023
e314514
Merge tag 'tags/8.18.0' into connatix
rares-mihai-preda Oct 6, 2023
7fdf0a3
added pgamsspBidAdapter because its alias was removed from adtelligen…
rares-mihai-preda Oct 6, 2023
33d11df
Merge tag 'tags/8.20.0' into connatix
rares-mihai-preda Oct 24, 2023
1cc4ada
added ozone as Connatix bidder partner
rares-mihai-preda Oct 25, 2023
e9e2fdd
added showheroes adapter
OctaviaS20 Nov 23, 2023
0a5525f
added seedtag bid adaptor
Alex404Damsa Nov 28, 2023
b18eccd
added minutemedia
OctaviaS20 Jan 9, 2024
858b330
removed duplicated minute media
rares-mihai-preda Jan 25, 2024
63b996c
Merge tag 'tags/8.37.0' into connatix
OctaviaS20 Feb 16, 2024
8cfda4b
Merge branch 'connatix' of github.com:Connatix/Prebid.js into connatix
OctaviaS20 Feb 16, 2024
2bf6a6d
Merge tag 'tags/8.38.0' into connatix
OctaviaS20 Feb 26, 2024
441bb53
added sovrn bid adapter
OctaviaS20 Mar 12, 2024
9879f30
fix: add consentManagementGpp module
mariuspotorconnatix Mar 14, 2024
4dbb923
added new build and gannet adapters
OctaviaS20 Apr 3, 2024
77cd4fd
renamed build command
OctaviaS20 Apr 3, 2024
67ee6f4
added specific modules for gannett
OctaviaS20 Apr 8, 2024
3da9065
added kueezRtb bid adaptor
Alex404Damsa May 24, 2024
5fb8f75
added video media type support for connatix bid adapter
Alex404Damsa Jun 13, 2024
15acad5
added all the recommended params to video media type mock
Alex404Damsa Jun 17, 2024
f8c2c44
improved validateVideo function
Alex404Damsa Jun 17, 2024
d0780cc
impreoved validateVideo function once again:)
Alex404Damsa Jun 17, 2024
0628621
removed redundant checks in bid request validation
Alex404Damsa Jun 17, 2024
10858da
clarified test it statement
Alex404Damsa Jun 17, 2024
5f457c4
improved unit tests
Alex404Damsa Jun 17, 2024
a855b23
updated validateVideo function
Alex404Damsa Jun 17, 2024
fabe6f6
removed modules.json
Alex404Damsa Jul 5, 2024
1762d93
removed connatix build script
Alex404Damsa Jul 5, 2024
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
44 changes: 36 additions & 8 deletions modules/connatixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
} from '../src/utils.js';

import {
ADPOD,
BANNER,
VIDEO,
} from '../src/mediaTypes.js';

const BIDDER_CODE = 'connatix';
Expand Down Expand Up @@ -41,10 +43,28 @@ export function getBidFloor(bid) {
}
}

export function validateBanner(mediaTypes) {
if (!mediaTypes[BANNER]) {
return true;
}

const banner = deepAccess(mediaTypes, BANNER, {});
return (Boolean(banner.sizes) && isArray(mediaTypes[BANNER].sizes) && mediaTypes[BANNER].sizes.length > 0);
}

export function validateVideo(mediaTypes) {
const video = mediaTypes[VIDEO];
if (!video) {
return true;
}

return video.context !== ADPOD;
}

export const spec = {
code: BIDDER_CODE,
gvlid: 143,
supportedMediaTypes: [BANNER],
supportedMediaTypes: [BANNER, VIDEO],

/*
* Validate the bid request.
Expand All @@ -57,17 +77,24 @@ export const spec = {
const params = deepAccess(bid, 'params', {});
const bidder = deepAccess(bid, 'bidder');

const banner = deepAccess(mediaTypes, BANNER, {});

const hasBidId = Boolean(bidId);
const isValidBidder = (bidder === BIDDER_CODE);
const isValidSize = (Boolean(banner.sizes) && isArray(mediaTypes[BANNER].sizes) && mediaTypes[BANNER].sizes.length > 0);
const hasSizes = mediaTypes[BANNER] ? isValidSize : false;
const hasMediaTypes = Boolean(mediaTypes) && (Boolean(mediaTypes[BANNER]) || Boolean(mediaTypes[VIDEO]));
const isValidBanner = validateBanner(mediaTypes);
const isValidVideo = validateVideo(mediaTypes);
const hasRequiredBidParams = Boolean(params.placementId);

const isValid = isValidBidder && hasBidId && hasSizes && hasRequiredBidParams;
const isValid = isValidBidder && hasBidId && hasMediaTypes && isValidBanner && isValidVideo && hasRequiredBidParams;
if (!isValid) {
logError(`Invalid bid request: isValidBidder: ${isValidBidder} hasBidId: ${hasBidId}, hasSizes: ${hasSizes}, hasRequiredBidParams: ${hasRequiredBidParams}`);
logError(
`Invalid bid request:
isValidBidder: ${isValidBidder},
hasBidId: ${hasBidId},
hasMediaTypes: ${hasMediaTypes},
isValidBanner: ${isValidBanner},
isValidVideo: ${isValidVideo},
hasRequiredBidParams: ${hasRequiredBidParams}`
);
}
return isValid;
},
Expand Down Expand Up @@ -128,12 +155,13 @@ export const spec = {
cpm: bidResponse.Cpm,
ttl: bidResponse.Ttl || DEFAULT_MAX_TTL,
currency: 'USD',
mediaType: BANNER,
mediaType: bidResponse.VastXml ? VIDEO : BANNER,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about adpod?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do not suport adpod mediatype. We filtered it out in the is isBidRequestValid method.

netRevenue: true,
width: bidResponse.Width,
height: bidResponse.Height,
creativeId: bidResponse.CreativeId,
ad: bidResponse.Ad,
vastXml: bidResponse.VastXml,
referrer: referrer,
}));
},
Expand Down
57 changes: 55 additions & 2 deletions test/spec/modules/connatixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
spec,
getBidFloor as connatixGetBidFloor
} from '../../../modules/connatixBidAdapter.js';
import { BANNER } from '../../../src/mediaTypes.js';
import { ADPOD, BANNER, VIDEO } from '../../../src/mediaTypes.js';

describe('connatixBidAdapter', function () {
let bid;
Expand All @@ -24,6 +24,26 @@ describe('connatixBidAdapter', function () {
};
};

function addVideoToBidMock(bid) {
const mediaTypes = {
video: {
context: 'instream',
w: 1280,
h: 720,
playerSize: [1280, 720],
placement: 1,
plcmt: 1,
api: [1, 2],
mimes: ['video/mp4', 'application/javascript'],
minduration: 30,
maxduration: 60,
startdelay: 0,
}
}

bid.mediaTypes = mediaTypes;
}

describe('isBidRequestValid', function () {
this.beforeEach(function () {
bid = mockBidRequest();
Expand Down Expand Up @@ -52,7 +72,7 @@ describe('connatixBidAdapter', function () {
delete bid.mediaTypes;
expect(spec.isBidRequestValid(bid)).to.be.false;
});
it('Should return false if banner is missing from mediaTypes ', function () {
it('Should return false if both banner and video are missing from mediaTypes', function () {
delete bid.mediaTypes.banner;
expect(spec.isBidRequestValid(bid)).to.be.false;
});
Expand All @@ -68,6 +88,15 @@ describe('connatixBidAdapter', function () {
bid.mediaTypes.banner.sizes = [];
expect(spec.isBidRequestValid(bid)).to.be.false;
});
it('Should return true if video is set correctly', function () {
addVideoToBidMock(bid);
expect(spec.isBidRequestValid(bid)).to.be.true;
});
it('Should return false if context is set to adpod on video media type', function() {
addVideoToBidMock(bid);
bid.mediaTypes.video.context = ADPOD;
expect(spec.isBidRequestValid(bid)).to.be.false;
});
it('Should return true if add an extra field was added to the bidRequest', function () {
bid.params.test = 1;
expect(spec.isBidRequestValid(bid)).to.be.true;
Expand Down Expand Up @@ -192,6 +221,30 @@ describe('connatixBidAdapter', function () {
expect(bidResponses[0].cpm).to.equal(firstBidCpm);
expect(bidResponses[1].cpm).to.equal(secondBidCpm);
});

it('Should contain specific values for banner bids', function () {
const adHtml = 'ad html'
serverResponse.body.Bids = [ { ...Bid, Ad: adHtml } ];

const bidResponses = spec.interpretResponse(serverResponse);
const [ bidResponse ] = bidResponses;

expect(bidResponse.vastXml).to.be.undefined;
expect(bidResponse.ad).to.equal(adHtml);
expect(bidResponse.mediaType).to.equal(BANNER);
});

it('Should contain specific values for video bids', function () {
const adVastXml = 'ad vast xml'
serverResponse.body.Bids = [ { ...Bid, VastXml: adVastXml } ];

const bidResponses = spec.interpretResponse(serverResponse);
const [ bidResponse ] = bidResponses;

expect(bidResponse.ad).to.be.undefined;
expect(bidResponse.vastXml).to.equal(adVastXml);
expect(bidResponse.mediaType).to.equal(VIDEO);
});
});

describe('getUserSyncs', function() {
Expand Down