Skip to content

Commit 9d252d4

Browse files
authored
Missena: add format params and onBidWon pixel (#9517)
1 parent 99ffff2 commit 9d252d4

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

modules/missenaBidAdapter.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { formatQS, logInfo } from '../src/utils.js';
1+
import { buildUrl, formatQS, logInfo, triggerPixel } from '../src/utils.js';
22
import { BANNER } from '../src/mediaTypes.js';
33
import { registerBidder } from '../src/adapters/bidderFactory.js';
44

55
const BIDDER_CODE = 'missena';
66
const ENDPOINT_URL = 'https://bid.missena.io/';
7+
const EVENTS_DOMAIN = 'events.missena.io';
8+
const EVENTS_DOMAIN_DEV = 'events.staging.missena.xyz';
79

810
export const spec = {
911
aliases: [BIDDER_CODE],
@@ -30,6 +32,7 @@ export const spec = {
3032
buildRequests: function (validBidRequests, bidderRequest) {
3133
return validBidRequests.map((bidRequest) => {
3234
const payload = {
35+
adunit: bidRequest.adUnitCode,
3336
request_id: bidRequest.bidId,
3437
timeout: bidderRequest.timeout,
3538
};
@@ -48,6 +51,15 @@ export const spec = {
4851
if (bidRequest.params.test) {
4952
payload.test = bidRequest.params.test;
5053
}
54+
if (bidRequest.params.placement) {
55+
payload.placement = bidRequest.params.placement;
56+
}
57+
if (bidRequest.params.formats) {
58+
payload.formats = bidRequest.params.formats;
59+
}
60+
if (bidRequest.params.isInternal) {
61+
payload.is_internal = bidRequest.params.isInternal;
62+
}
5163
return {
5264
method: 'POST',
5365
url: baseUrl + '?' + formatQS({ t: bidRequest.params.apiKey }),
@@ -109,6 +121,15 @@ export const spec = {
109121
* @param {Bid} The bid that won the auction
110122
*/
111123
onBidWon: function (bid) {
124+
const hostname = bid.params[0].baseUrl ? EVENTS_DOMAIN_DEV : EVENTS_DOMAIN;
125+
triggerPixel(
126+
buildUrl({
127+
protocol: 'https',
128+
hostname,
129+
pathname: '/v1/bidsuccess',
130+
search: { t: bid.params[0].apiKey },
131+
})
132+
);
112133
logInfo('Missena - Bid won', bid);
113134
},
114135
};

test/spec/modules/missenaBidAdapter_spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ describe('Missena Adapter', function () {
1313
sizes: [[1, 1]],
1414
params: {
1515
apiKey: 'PA-34745704',
16+
placement: 'sticky',
17+
formats: ['sticky-banner'],
1618
},
1719
};
1820

@@ -70,6 +72,14 @@ describe('Missena Adapter', function () {
7072
expect(payload.request_id).to.equal(bidId);
7173
});
7274

75+
it('should send placement', function () {
76+
expect(payload.placement).to.equal('sticky');
77+
});
78+
79+
it('should send formats', function () {
80+
expect(payload.formats).to.eql(['sticky-banner']);
81+
});
82+
7383
it('should send referer information to the request', function () {
7484
expect(payload.referer).to.equal('https://referer');
7585
expect(payload.referer_canonical).to.equal('https://canonical');

0 commit comments

Comments
 (0)