Skip to content

Commit deeabca

Browse files
authored
Merge pull request #12 from freestarcapital/ENG-1138
Eng 1138
2 parents 5610f23 + 1c4cd94 commit deeabca

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

modules/freestarBidAdapter.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {config} from 'src/config';
22
import {registerBidder} from 'src/adapters/bidderFactory';
33
import {BANNER, NATIVE, VIDEO} from "../src/mediaTypes";
44
const BIDDER_CODE = 'freestar';
5-
const ENDPOINT_URL = 'https://ssp.pub.network/ssp-server/HeaderBiddingService';
5+
const ENDPOINT_URL = (window.location.search.indexOf('fsdebug') === -1) ? 'https://ssp.pub.network/ssp-server/HeaderBiddingService' : 'https://dev-ssp.pub.network/ssp-server/HeaderBiddingService';
66
const syncURLs = [];
77
export const spec = {
88
code: BIDDER_CODE,
@@ -102,7 +102,10 @@ export const spec = {
102102
winner.winningSeat.bid[0],
103103
)));
104104
if(typeof winner.supplier.cookieSync != 'undefined') {
105-
syncURLs.push(decodeURIComponent(winner.supplier.cookieSync).split('\'')[1]);
105+
syncURLs.push({
106+
type: 'image',
107+
url: decodeURIComponent(winner.supplier.cookieSync).split('\'')[1]
108+
});
106109
}
107110
}
108111
}
@@ -111,8 +114,8 @@ export const spec = {
111114
// @TODO: How are we doing user sync?
112115
getUserSyncs: function(syncOptions) {
113116
if(syncURLs.length > 0) {
114-
let tmp = syncURLs.filter((elm, pos, arr) => {
115-
console.log('freestar::', 'elm, pos, arr', elm, pos, arr);
117+
let tmp = syncURLs.filter((syncURL) => {
118+
console.log('freestar::', 'syncURL', syncURL);
116119
});
117120
}
118121
return false;
@@ -130,17 +133,21 @@ registerBidder(spec);
130133
* @returns {{requestId, cpm, width, height, creativeId: string|string|string|*|string|string, currency, netRevenue: boolean, ttl: number, ad}}
131134
*/
132135
function parseBid(bid) {
136+
let adUnit = bid.adm, cpm = (window.location.search.indexOf('fsbidprice') === -1) ? bid.price : 25.00;
137+
if(typeof bid.nurl != 'undefined') {
138+
adUnit = `<img src="${bid.nurl.replace('${AUCTION_PRICE}', cpm)}" width="0" height="0" style="display:none">` + adUnit;
139+
}
133140
const bidResponse = {
134141
requestId: bid.impid,
135-
cpm: bid.price,
142+
cpm: cpm,
136143
width: bid.w,
137144
height: bid.h,
138145
creativeId: bid.cid, //@TODO: verify
139146
// // dealId: DEAL_ID,
140147
currency: bid.currency,
141148
netRevenue: true,
142149
ttl: 60, //@TODO: verify
143-
ad: bid.adm
150+
ad: adUnit
144151
};
145152
return bidResponse;
146153
}

0 commit comments

Comments
 (0)