Skip to content

Commit

Permalink
New dimension for tracking name of the matching adUnit pattern (#6252)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrmartinez authored Feb 3, 2021
1 parent 3e99b0d commit d1900a9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/rubiconAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ function sendMessage(auctionId, bidWonId) {
'dimensions',
'adserverTargeting', () => stringProperties(cache.targeting[bid.adUnit.adUnitCode] || {}),
'gam',
'pbAdSlot'
'pbAdSlot',
'pattern'
]);
adUnit.bids = [];
adUnit.status = 'no-bid'; // default it to be no bid
Expand Down Expand Up @@ -651,7 +652,8 @@ let rubiconAdapter = Object.assign({}, baseAdapter, {
return {adSlot: bid.fpd.context.adServer.adSlot}
}
},
'pbAdSlot', () => utils.deepAccess(bid, 'fpd.context.pbAdSlot')
'pbAdSlot', () => utils.deepAccess(bid, 'fpd.context.pbAdSlot'),
'pattern', () => utils.deepAccess(bid, 'fpd.context.aupName')
])
]);
return memo;
Expand Down
29 changes: 29 additions & 0 deletions test/spec/modules/rubiconAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,35 @@ describe('rubicon analytics adapter', function () {
expect(timedOutBid).to.not.have.property('bidResponse');
});

it('should pass aupName as pattern', function () {
let bidRequest = utils.deepClone(MOCK.BID_REQUESTED);
bidRequest.bids[0].fpd = {
context: {
aupName: '1234/mycoolsite/*&gpt_leaderboard&deviceType=mobile'
}
};
bidRequest.bids[1].fpd = {
context: {
aupName: '1234/mycoolsite/*&gpt_skyscraper&deviceType=mobile'
}
};
events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
events.emit(BID_REQUESTED, bidRequest);
events.emit(BID_RESPONSE, MOCK.BID_RESPONSE[0]);
events.emit(BIDDER_DONE, MOCK.BIDDER_DONE);
events.emit(AUCTION_END, MOCK.AUCTION_END);
events.emit(SET_TARGETING, MOCK.SET_TARGETING);

clock.tick(SEND_TIMEOUT + 1000);

expect(server.requests.length).to.equal(1);

let message = JSON.parse(server.requests[0].requestBody);
validate(message);
expect(message.auctions[0].adUnits[0].pattern).to.equal('1234/mycoolsite/*&gpt_leaderboard&deviceType=mobile');
expect(message.auctions[0].adUnits[1].pattern).to.equal('1234/mycoolsite/*&gpt_skyscraper&deviceType=mobile');
});

it('should successfully convert bid price to USD in parseBidResponse', function () {
// Set the rates
setConfig({
Expand Down

0 comments on commit d1900a9

Please sign in to comment.