Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LuponMedia BidAdapter: Add adomain to bidResponse #12604

Merged
merged 5 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions modules/luponmediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {config} from '../src/config.js';
import {BANNER} from '../src/mediaTypes.js';
import {ajax} from '../src/ajax.js';

const BIDDER_CODE = 'luponmedia';
const ENDPOINT_URL = 'https://rtb.adxpremium.services/openrtb2/auction';
Expand Down Expand Up @@ -170,7 +169,11 @@ export const spec = {
netRevenue: false,
ttl: 300,
referrer: parsedReferrer,
ad: bid.adm
ad: bid.adm,
adomain: bid.adomain || [],
meta: {
advertiserDomains: bid && bid.adomain ? bid.adomain : []
}
};

bidResponses.push(newBid);
Expand Down Expand Up @@ -220,19 +223,6 @@ export const spec = {

hasSynced = true;
return allUserSyncs;
},
onBidWon: bid => {
const bidString = JSON.stringify(bid);
spec.sendWinningsToServer(bidString);
},
sendWinningsToServer: data => {
let mutation = `mutation {createWin(input: {win: {eventData: "${window.btoa(data)}"}}) {win {createTime } } }`;
let dataToSend = JSON.stringify({ query: mutation });

ajax('https://analytics.adxpremium.services/graphql', null, dataToSend, {
contentType: 'application/json',
method: 'POST'
});
}
};

Expand Down Expand Up @@ -469,9 +459,7 @@ function newOrtbBidRequest(bidRequest, bidderRequest, currentImps) {
deepSetValue(data, 'ext.prebid.bidderconfig.0', bidderData);
}

// TODO: bidRequest.fpd is not the right place for pbadslot - who's filling that in, if anyone?
// is this meant to be bidRequest.ortb2Imp.ext.data.pbadslot?
const pbAdSlot = deepAccess(bidRequest, 'fpd.context.pbAdSlot');
const pbAdSlot = deepAccess(bidRequest, 'ortb2Imp.ext.data.pbadslot');
if (typeof pbAdSlot === 'string' && pbAdSlot) {
deepSetValue(data.imp[0].ext, 'context.data.adslot', pbAdSlot);
}
Expand Down
45 changes: 0 additions & 45 deletions test/spec/modules/luponmediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,49 +385,4 @@ describe('luponmediaBidAdapter', function () {
expect(checkSchain).to.equal(false);
});
});

describe('onBidWon', function () {
const bidWonEvent = {
'bidderCode': 'luponmedia',
'width': 300,
'height': 250,
'statusMessage': 'Bid available',
'adId': '105bbf8c54453ff',
'requestId': '934b8752185955',
'mediaType': 'banner',
'source': 'client',
'cpm': 0.364,
'creativeId': '443801010',
'currency': 'USD',
'netRevenue': false,
'ttl': 300,
'referrer': '',
'ad': '',
'auctionId': '926a8ea3-3dd4-4bf2-95ab-c85c2ce7e99b',
'responseTimestamp': 1598527728026,
'requestTimestamp': 1598527727629,
'bidder': 'luponmedia',
'adUnitCode': 'div-gpt-ad-1533155193780-5',
'timeToRespond': 397,
'size': '300x250',
'status': 'rendered'
};

let ajaxStub;

beforeEach(() => {
ajaxStub = sinon.stub(spec, 'sendWinningsToServer')
})

afterEach(() => {
ajaxStub.restore()
})

it('calls luponmedia\'s callback endpoint', () => {
const result = spec.onBidWon(bidWonEvent);
expect(result).to.equal(undefined);
expect(ajaxStub.calledOnce).to.equal(true);
expect(ajaxStub.firstCall.args[0]).to.deep.equal(JSON.stringify(bidWonEvent));
});
});
});
Loading