Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
RTBHouse Bid Adapter: change source.tid to contain auctionId and …
Browse files Browse the repository at this point in the history
…populate imp-level `ext.tid` (prebid#9726)

* RTBHouse Bid Adapter: add global vendor list id

* structured user agent - browsers.brands

* fix lint errors

* Added sda into rtbhouse adapter

* spreading ortb2: user & site props

* examples reverted

* init version

* using mergedeep

* removed wrong imp array augm.; slot imp augm. with addtl check

* [SUA] merging ortb2.device into request

* fledge auctionConfig adapted to our bid response structure

* new bidder response structure for fledge

* make sure bidderRequest has proper flag turned on

* fledge endpoint hardcoded; code cleanups

* remove obsolete function

* obsolete function removed

* [RTB House] Process FLEDGE request/response (#4)

* [SDA & SUA] refactor using mergedeep

* [FLEDGE] fledge auctionConfig adapted to our bid response structure

* [FLEDGE] new bidder response structure for fledge

* [FLEDGE] make sure bidderRequest has proper flag turned on

* [FLEDGE] fledge endpoint hardcoded; code cleanups

* [FLEDGE] remove obsolete functions

* fixed lint errors

* fledge test suites; adapter: delete imp.ext.ae when no fledge (#5)

* RTBHouse Bid Adapter: use auctionId for source.tid

* RTBHouse bid adapter: fixed source.tid tests

* Imp level transaction id + mapSource fix

* lint: removed obsolete whitespaces

* RTBHouse Bid Adapter: change `source.tid` to contain `auctionId` and populate imp-level `ext.tid` (#8)

* RTBHouse Bid Adapter: use auctionId for source.tid

* Imp level transaction id + mapSource fix

* lint: removed obsolete whitespaces

---------

Co-authored-by: Leandro Otani <[email protected]>
Co-authored-by: rtbh-lotani <[email protected]>
Co-authored-by: Tomasz Swirski <[email protected]>
  • Loading branch information
4 people authored Mar 29, 2023
1 parent dd4bd96 commit a07ab71
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
13 changes: 10 additions & 3 deletions modules/rtbhouseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const spec = {
site: mapSite(validBidRequests, bidderRequest),
cur: DEFAULT_CURRENCY_ARR,
test: validBidRequests[0].params.test || 0,
source: mapSource(validBidRequests[0]),
source: mapSource(validBidRequests[0], bidderRequest),
};

if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies) {
Expand Down Expand Up @@ -228,6 +228,13 @@ function mapImpression(slot, bidderRequest) {
delete imp.ext.ae;
}
}

const tid = deepAccess(slot, 'ortb2Imp.ext.tid');
if (tid) {
imp.ext = imp.ext || {};
imp.ext.tid = tid;
}

return imp;
}

Expand Down Expand Up @@ -283,9 +290,9 @@ function mapSite(slot, bidderRequest) {
* @param {object} slot Ad Unit Params by Prebid
* @returns {object} Source by OpenRTB 2.5 §3.2.2
*/
function mapSource(slot) {
function mapSource(slot, bidderRequest) {
const source = {
tid: slot.transactionId,
tid: bidderRequest?.auctionId || '',
};

return source;
Expand Down
32 changes: 23 additions & 9 deletions test/spec/modules/rtbhouseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,18 @@ describe('RTBHouseAdapter', () => {

describe('buildRequests', function () {
let bidRequests;
const bidderRequest = {
'refererInfo': {
'numIframes': 0,
'reachedTop': true,
'referer': 'https://example.com',
'stack': ['https://example.com']
}
};
let bidderRequest;

beforeEach(() => {
bidderRequest = {
'auctionId': 'bidderrequest-auction-id',
'refererInfo': {
'numIframes': 0,
'reachedTop': true,
'referer': 'https://example.com',
'stack': ['https://example.com']
}
};
bidRequests = [
{
'bidder': 'rtbhouse',
Expand All @@ -82,6 +84,11 @@ describe('RTBHouseAdapter', () => {
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475',
'transactionId': 'example-transaction-id',
'ortb2Imp': {
'ext': {
'tid': 'ortb2Imp-transaction-id-1'
}
},
'schain': {
'ver': '1.0',
'complete': 1,
Expand Down Expand Up @@ -203,7 +210,7 @@ describe('RTBHouseAdapter', () => {
const bidRequest = Object.assign([], bidRequests);
const request = spec.buildRequests(bidRequest, bidderRequest);
const data = JSON.parse(request.data);
expect(data.source.tid).to.equal('example-transaction-id');
expect(data.source.tid).to.equal('bidderrequest-auction-id');
});

it('should include bidfloor from floor module if avaiable', () => {
Expand Down Expand Up @@ -256,6 +263,13 @@ describe('RTBHouseAdapter', () => {
expect(data.source).to.have.deep.property('tid');
});

it('should include impression level transaction id when provided', () => {
const bidRequest = Object.assign([], bidRequests);
const request = spec.buildRequests(bidRequest, bidderRequest);
const data = JSON.parse(request.data);
expect(data.imp[0].ext.tid).to.equal('ortb2Imp-transaction-id-1');
});

it('should not include invalid schain', () => {
const bidRequest = Object.assign([], bidRequests);
bidRequest[0].schain = {
Expand Down

0 comments on commit a07ab71

Please sign in to comment.