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

Relaido Bid Adapter: change to get the renderer URL for each response #8085

Merged
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
4 changes: 2 additions & 2 deletions modules/relaidoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ function interpretResponse(serverResponse, bidRequest) {
return [];
}

const playerUrl = bidRequest.player || body.playerUrl;

for (const res of body.ads) {
const playerUrl = res.playerUrl || bidRequest.player || body.playerUrl;
let bidResponse = {
requestId: res.bidId,
width: res.width,
height: res.height,
cpm: res.price,
currency: res.currency,
creativeId: res.creativeId,
playerUrl: playerUrl,
dealId: body.dealId || '',
ttl: body.ttl || DEFAULT_TTL,
netRevenue: true,
Expand Down
19 changes: 19 additions & 0 deletions test/spec/modules/relaidoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ describe('RelaidoAdapter', function () {
expect(response.currency).to.equal(serverResponse.body.ads[0].currency);
expect(response.creativeId).to.equal(serverResponse.body.ads[0].creativeId);
expect(response.vastXml).to.equal(serverResponse.body.ads[0].vast);
expect(response.playerUrl).to.equal(serverResponse.body.playerUrl);
expect(response.meta.advertiserDomains).to.equal(serverResponse.body.ads[0].adomain);
expect(response.meta.mediaType).to.equal(VIDEO);
expect(response.ad).to.be.undefined;
Expand All @@ -320,11 +321,29 @@ describe('RelaidoAdapter', function () {
expect(response.currency).to.equal(serverResponse.body.ads[0].currency);
expect(response.creativeId).to.equal(serverResponse.body.ads[0].creativeId);
expect(response.vastXml).to.be.undefined;
expect(response.playerUrl).to.equal(serverResponse.body.playerUrl);
expect(response.ad).to.include(`<div id="rop-prebid">`);
expect(response.ad).to.include(`<script src="https://relaido/player.js"></script>`);
expect(response.ad).to.include(`window.RelaidoPlayer.renderAd`);
});

it('should build bid response by video and playerUrl in ads', function () {
serverResponse.body.ads[0].playerUrl = 'https://relaido/player-customized.js';
const bidResponses = spec.interpretResponse(serverResponse, serverRequest);
expect(bidResponses).to.have.lengthOf(1);
const response = bidResponses[0];
expect(response.playerUrl).to.equal(serverResponse.body.ads[0].playerUrl);
});

it('should build bid response by banner and playerUrl in ads', function () {
serverResponse.body.ads[0].playerUrl = 'https://relaido/player-customized.js';
serverResponse.body.ads[0].mediaType = 'banner';
const bidResponses = spec.interpretResponse(serverResponse, serverRequest);
expect(bidResponses).to.have.lengthOf(1);
const response = bidResponses[0];
expect(response.playerUrl).to.equal(serverResponse.body.ads[0].playerUrl);
});

it('should not build bid response', function () {
serverResponse = {};
const bidResponses = spec.interpretResponse(serverResponse, serverRequest);
Expand Down