Skip to content

Commit

Permalink
Relaido Bid Adapter: change to get the renderer URL for each response (
Browse files Browse the repository at this point in the history
…#8085)

* add relaido adapter

* remove event listener

* fixed UserSyncs and e.data

* fix conflicts

* supports for the case where playerUrl is defined inside ads

Co-authored-by: ishigami_shingo <s.ishigami@relaido.co.jp>
Co-authored-by: cmertv-sishigami <s.ishigami@cmertv.com>
Co-authored-by: t_bun <t.bun@cmertv.com>
Co-authored-by: n.maeura <n.maeura@cmertv.com>
  • Loading branch information
5 people authored Feb 18, 2022
1 parent 5eacb78 commit 0da181a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
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

0 comments on commit 0da181a

Please sign in to comment.