Skip to content

Commit

Permalink
Cookie Sync functionality (prebid#4457)
Browse files Browse the repository at this point in the history
* changing PID param value for testing

* cookie sync integration

* merge from upstream
  • Loading branch information
rade-popovic authored and sa1omon committed Nov 28, 2019
1 parent cd28151 commit 57537ce
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions modules/nanointeractiveBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const SUB_ID = 'subId';
export const REF = 'ref';
export const LOCATION = 'loc';

var nanoPid = '5a1ec660eb0a191dfa591172';

export const spec = {

code: BIDDER_CODE,
Expand All @@ -29,7 +31,7 @@ export const spec = {
validBidRequests.forEach(
bid => payload.push(createSingleBidRequest(bid, bidderRequest))
);
const url = getEndpointUrl('main') + '/hb';
const url = getEndpointUrl() + '/hb';

return {
method: 'POST',
Expand All @@ -45,13 +47,33 @@ export const spec = {
}
});
return bids;
},
getUserSyncs: function(syncOptions) {
const syncs = [];
if (syncOptions.iframeEnabled) {
syncs.push({
type: 'iframe',
url: getEndpointUrl() + '/hb/cookieSync/' + nanoPid
});
}

if (syncOptions.pixelEnabled) {
syncs.push({
type: 'image',
url: getEndpointUrl() + '/hb/cookieSync/' + nanoPid
});
}
return syncs;
}

};

function createSingleBidRequest(bid, bidderRequest) {
const location = utils.deepAccess(bidderRequest, 'refererInfo.referer');
const origin = utils.getOrigin();

nanoPid = bid.params[SSP_PLACEMENT_ID] || nanoPid;

const data = {
[SSP_PLACEMENT_ID]: bid.params[SSP_PLACEMENT_ID],
[NQ]: [createNqParam(bid)],
Expand Down Expand Up @@ -117,10 +139,9 @@ function isEngineResponseValid(response) {
/**
* Used mainly for debugging
*
* @param type
* @returns string
*/
function getEndpointUrl(type) {
function getEndpointUrl() {
const nanoConfig = config.getConfig('nano');
return (nanoConfig && nanoConfig['endpointUrl']) || END_POINT_URL;
}
Expand Down

0 comments on commit 57537ce

Please sign in to comment.