Skip to content

Commit

Permalink
Add extra checks for events
Browse files Browse the repository at this point in the history
  • Loading branch information
eldzis committed Dec 5, 2023
1 parent f1b18fe commit e06d20a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions modules/setupadBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export const spec = {
getPixelUrl: function (eventName, bid, timestamp) {
let bidder = bid.bidder || bid.bidderCode;
const auctionId = bid.auctionId;
if (bidder != BIDDER_CODE) return;
if (bidder !== BIDDER_CODE) return;

let params;
if (bid.params) {
Expand All @@ -238,14 +238,14 @@ export const spec = {

let extraBidParams = '';

if (eventName === 'bidResponse') {
if (eventName === CONSTANTS.EVENTS.BID_RESPONSE) {
bidder = JSON.stringify(biddersCpms);

// Add extra parameters
extraBidParams = `&currency=${bid.originalCurrency}`;
}

if (eventName === 'bidWon') {
if (eventName === CONSTANTS.EVENTS.BID_WON) {
// Iterate through all bidders to find the winning bidder by using creativeId as identification
for (const bidderName in biddersCreativeIds) {
if (
Expand All @@ -261,6 +261,14 @@ export const spec = {
extraBidParams = `&cpm=${bid.originalCpm}&currency=${bid.originalCurrency}`;
}

if (
eventName === CONSTANTS.EVENTS.BID_REQUESTED ||
eventName === CONSTANTS.EVENTS.BID_TIMEOUT ||
eventName === CONSTANTS.EVENTS.NO_BID
) {
bidder = BIDDER_CODE;
}

const url = `${REPORT_ENDPOINT}?event=${eventName}&bidder=${bidder}&placementIds=${placementIds}&auctionId=${auctionId}${extraBidParams}&timestamp=${timestamp}`;

return url;
Expand Down

0 comments on commit e06d20a

Please sign in to comment.