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

Smartadserver Bid Adapter: Update default value of startDelay video parameter #11225

Merged
merged 35 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8acd2b4
Smartadserver Bid Adapter: Add support for SDA user and site
mcourouble Nov 9, 2022
d3387b8
Merge branch 'prebid:master' into master
krzysztofequativ Nov 15, 2022
72c7169
Merge remote-tracking branch 'upstream/master'
mcourouble Nov 16, 2022
24ebad8
Smartadserver Bid Adapter: Fix SDA support getConfig and add to unit …
mcourouble Nov 16, 2022
3952d84
Merge branch 'prebid:master' into master
krzysztofequativ Jan 13, 2023
36312fd
support floors per media type
krzysztofequativ Jan 17, 2023
f7f51b6
Merge pull request #14 from smartadserver/floor-per-mediatype
krzysztofequativ Jan 18, 2023
18c659b
Merge branch 'prebid:master' into master
krzysztofequativ Jan 23, 2023
de0d762
Add GPP support
krzysztofequativ Jan 24, 2023
5b89a6e
Rework payloads enriching
krzysztofequativ Jan 24, 2023
6db82d2
Merge pull request #16 from smartadserver/floor-per-mediatype
krzysztofequativ Jan 25, 2023
f5767f7
Merge branch 'prebid:master' into master
krzysztofequativ Jan 26, 2023
9ef7251
Merge branch 'master' into gpp
krzysztofequativ Feb 1, 2023
d4dcbf9
Merge pull request #15 from smartadserver/gpp
krzysztofequativ Feb 1, 2023
fe96171
Merge branch 'prebid:master' into master
krzysztofequativ Feb 1, 2023
0a12454
Merge branch 'prebid:master' into master
krzysztofequativ Feb 2, 2023
10ee3df
Merge branch 'prebid:master' into master
krzysztofequativ May 19, 2023
7323339
Add gpid support
krzysztofequativ May 22, 2023
ebcb8e5
Merge pull request #17 from smartadserver/gpid
krzysztofequativ May 26, 2023
62a184d
Merge branch 'prebid:master' into master
krzysztofequativ Nov 30, 2023
2795791
Support additional video params
krzysztofequativ Dec 1, 2023
dd0e886
vpmt as array of numbers
krzysztofequativ Dec 6, 2023
000f8e1
Merge pull request #18 from smartadserver/video-params
krzysztofequativ Dec 11, 2023
f7d3573
Merge branch 'prebid:master' into master
krzysztofequativ Dec 11, 2023
9f5d9d2
Fix comment
krzysztofequativ Jan 3, 2024
9f6f72c
Merge branch 'prebid:master' into master
darekodz Feb 26, 2024
a43c345
Merge branch 'prebid:master' into master
krzysztofequativ Mar 6, 2024
d8d0b67
Update default startDelay
krzysztofequativ Mar 12, 2024
93abe8c
Merge pull request #19 from smartadserver/default-startdelay
krzysztofequativ Mar 18, 2024
2eb6fd8
Merge branch 'prebid:master' into master
krzysztofequativ Mar 18, 2024
78f1201
Include videoMediaType's startdelay
krzysztofequativ Mar 19, 2024
f3c5ded
Merge pull request #20 from smartadserver/default-startdelay
krzysztofequativ Mar 19, 2024
f4dd203
Handle specified midroll
krzysztofequativ Mar 25, 2024
70a4a89
Merge pull request #21 from smartadserver/default-startdelay
krzysztofequativ Mar 25, 2024
64bb962
Merge branch 'prebid:master' into master
krzysztofequativ Mar 27, 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
10 changes: 4 additions & 6 deletions modules/smartadserverBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,16 @@ export const spec = {
* @returns positive integer value of startdelay
*/
getStartDelayForVideoBidRequest: function(videoMediaType, videoParams) {
if (videoParams !== undefined && videoParams.startDelay) {
if (videoParams?.startDelay) {
return videoParams.startDelay;
} else if (videoMediaType !== undefined) {
if (videoMediaType.startdelay == 0) {
return 1;
} else if (videoMediaType.startdelay == -1) {
} else if (videoMediaType?.startdelay) {
if (videoMediaType.startdelay > 0 || videoMediaType.startdelay == -1) {
return 2;
} else if (videoMediaType.startdelay == -2) {
return 3;
}
}
return 2;// Default value for all exotic cases set to bid.params.video.startDelay midroll hence 2.
return 1; // SADR-5619
Copy link
Collaborator

@patmmccann patmmccann Mar 18, 2024

Choose a reason for hiding this comment

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

this appears wrong; what do you do if videoMediaType.startdelay is say, 180? In this case, you appear to ignore the declaration and guess that it is preroll?
Also, you seem to have dropped the .startdelay from your switch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, @patmmccann, I've updated the implementation. Thx.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If the publisher specifies midroll starting at 3 minutes (180), you are calling it preroll still?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are completely right. It's fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @patmmccann, could you review it, please? Thx.

},

/**
Expand Down
48 changes: 46 additions & 2 deletions test/spec/modules/smartadserverBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ describe('Smart bid adapter tests', function () {
const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('videoData');
expect(requestContent.videoData).not.to.have.property('videoProtocol').eq(true);
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(2);
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(1);
});

it('Verify videoData params override meta values', function () {
Expand Down Expand Up @@ -1097,7 +1097,7 @@ describe('Smart bid adapter tests', function () {
const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('videoData');
expect(requestContent.videoData).not.to.have.property('videoProtocol').eq(true);
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(2);
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(1);
});

it('Verify videoData params override meta values', function () {
Expand Down Expand Up @@ -1143,6 +1143,50 @@ describe('Smart bid adapter tests', function () {
expect(requestContent.videoData).to.have.property('videoProtocol').and.to.equal(6);
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(3);
});

it('should handle value of videoMediaType.startdelay', function () {
const request = spec.buildRequests([{
bidder: 'smartadserver',
mediaTypes: {
video: {
context: 'outstream',
playerSize: [[640, 480]],
startdelay: -2
}
},
params: {
siteId: 123,
pageId: 456,
formatId: 78
}
}]);

const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('videoData');
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(3);
});

it('should return specified value of videoMediaType.startdelay', function () {
const request = spec.buildRequests([{
bidder: 'smartadserver',
mediaTypes: {
video: {
context: 'outstream',
playerSize: [[640, 480]],
startdelay: 60
}
},
params: {
siteId: 123,
pageId: 456,
formatId: 78
}
}]);

const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('videoData');
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(2);
});
});

describe('External ids tests', function () {
Expand Down