Skip to content

Commit

Permalink
Fix referer (prebid#5274)
Browse files Browse the repository at this point in the history
* add relaido adapter

* remove event listener

* fixed UserSyncs and e.data

* fix conflicts

* add referer at the end of the payload

* add test

Co-authored-by: ishigami_shingo <s.ishigami@relaido.co.jp>
  • Loading branch information
2 people authored and iggyfisk committed Jun 22, 2020
1 parent df5d714 commit 238175d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/relaidoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getStorageManager } from '../src/storageManager.js';

const BIDDER_CODE = 'relaido';
const BIDDER_DOMAIN = 'api.relaido.jp';
const ADAPTER_VERSION = '1.0.0';
const ADAPTER_VERSION = '1.0.1';
const DEFAULT_TTL = 300;
const UUID_KEY = 'relaido_uuid';

Expand Down Expand Up @@ -51,7 +51,6 @@ function buildRequests(validBidRequests, bidderRequest) {

let payload = {
version: ADAPTER_VERSION,
ref: bidderRequest.refererInfo.referer,
timeout_ms: bidderRequest.timeout,
ad_unit_code: bidRequest.adUnitCode,
auction_id: bidRequest.auctionId,
Expand All @@ -74,6 +73,9 @@ function buildRequests(validBidRequests, bidderRequest) {
payload.height = sizes[0][1];
}

// It may not be encoded, so add it at the end of the payload
payload.ref = bidderRequest.refererInfo.referer;

bidRequests.push({
method: 'GET',
url: bidUrl,
Expand Down
9 changes: 9 additions & 0 deletions test/spec/modules/relaidoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ describe('RelaidoAdapter', function () {
const request = bidRequests[0];
expect(request.mediaType).to.equal('banner');
});

it('The referrer should be the last', function () {
const bidRequests = spec.buildRequests([bidRequest], bidderRequest);
expect(bidRequests).to.have.lengthOf(1);
const request = bidRequests[0];
const keys = Object.keys(request.data);
expect(keys[0]).to.equal('version');
expect(keys[keys.length - 1]).to.equal('ref');
});
});

describe('spec.interpretResponse', function () {
Expand Down

0 comments on commit 238175d

Please sign in to comment.