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

Audigent RTD configurable per-bidder segment mappings #5903

Merged
merged 26 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
129 changes: 5 additions & 124 deletions integrationExamples/gpt/haloRtdProvider_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,9 @@
googletag.pubads().disableInitialLoad();
});

var bidSegmentMappers = {
appnexus: function(bid, segments) {
if (!bid.params) {
bid.params = {}
}
if (!bid.params.user) {
bid.params.user = {}
}
antlauzon marked this conversation as resolved.
Show resolved Hide resolved
var testHaloId = "030tstezbb07jv2yg08xizqr0bwpa0c0evvmq00eivtcg0nc9v970ntek210qskvk40trr7270wqxik90zq3u2d12pa5j3137rx2918nmsj905vat8b1elzfjf1hl5r1i1kkc2jl";

bid.params.user.segments = segments;
}
}
window.localStorage.setItem('auHaloId', testHaloId);

pbjs.que.push(function() {
pbjs.setConfig({
Expand All @@ -134,116 +125,6 @@
timeout: 1000,
defaultGdprScope: true
},
userSync: {
userIds: [{
name: "unifiedId",
params: {
partner: "prebid",
url: "http://match.adsrvr.org/track/rid?ttd_pid=prebid&fmt=json"
},
storage: {
type: "html5",
name: "unifiedid",
expires: 30
},
}, {
name: "intentIqId",
params: {
partner: 0, //Set your real IntentIQ partner ID here for production.
},
storage: {
type: "cookie",
name: "intentIqId",
expires: 30
},
}, {
name: "id5Id",
params: {
partner: 173 //Set your real ID5 partner ID here for production, please ask for one at http://id5.io/prebid
},
storage: {
type: "cookie",
name: "id5id",
expires: 90,
refreshInSeconds: 8*3600 // Refresh frequency of cookies, defaulting to 'expires'
},

}, {
name: "merkleId",
params: {
ptk: '12345678-aaaa-bbbb-cccc-123456789abc', //Set your real merkle partner key here
pubid: 'EXAMPLE' //Set your real merkle publisher id here
},
storage: {
type: "html5",
name: "merkleId",
expires: 30
},

}, {
name: "parrableId",
params: {
// change to Parrable Partner Client ID(s) you received from the Parrable Partners you are using
partner: '30182847-e426-4ff9-b2b5-9ca1324ea09b'
}
}, {
name: "pubCommonId",
storage: {
type: "cookie",
name: "pubcid",
expires: 365
},
// value: {
// foo: '9879878907987',
// bar:'93939'
// }
}, {
name: 'identityLink',
params: {
pid: '14' // Set your real identityLink placement ID here
},
storage: {
type: 'cookie',
name: 'idl_env',
expires: 30
}
}, {
name: "sharedId",
params: {
syncTime: 60 // in seconds, default is 24 hours
},
storage: {
type: "cookie",
name: "sharedid",
expires: 28
}
}, {
name: 'lotamePanoramaId'
}, {
name: "liveIntentId",
params: {
publisherId: "9896876"
},
storage: {
type: "cookie",
name: "_li_pbid",
expires: 28
}
}, {
name: "zeotapIdPlus"
}, {
name: 'haloId',
storage: {
type: "cookie",
name: "haloId",
expires: 28
}
}, {
name: "quantcastId"
}],
syncDelay: 5000,
auctionDelay: 1000
},
realTimeData: {
auctionDelay: testAuctionDelay, // lower in real scenario to meet publisher spec
dataProviders: [
Expand All @@ -270,8 +151,8 @@
});

function sendAdserverRequest() {
document.getElementById('tdid').innerHTML = adUnits[0].bids[0].userId['tdid'];
document.getElementById('audigent_segments').innerHTML = JSON.stringify(adUnits[0].bids[0].params.user.segments);
document.getElementById('halo_id').innerHTML = testHaloId;

if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
Expand Down Expand Up @@ -319,8 +200,8 @@ <h2>Audigent Segments Prebid</h2>
</script>
</div>

TDID:
<div id='tdid'>
Halo Id:
<div id='halo_id'>
</div>

Audigent Segments (Appnexus):
Expand Down
10 changes: 2 additions & 8 deletions modules/haloRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const storage = getStorageManager();
/** @type {string} */
const MODULE_NAME = 'realTimeData';
const SUBMODULE_NAME = 'halo';
const ERR_MSG = 'AUDIGENT_ERR';

export const HALOID_LOCAL_NAME = 'auHaloId';
export const SEG_LOCAL_NAME = '__adgntseg';
Expand Down Expand Up @@ -62,13 +61,12 @@ export function addSegmentData(adUnits, segmentData, config) {
set(bid, 'fpd.user.data', []);
if (Array.isArray(bid.fpd.user.data)) {
bid.fpd.user.data.forEach(fpdData => {
if (fpdData.name) { config.params.mapSegments[fpdData.name] = true; }
let segments = segmentData[fpdData.id] || segmentData[fpdData.name] || [];
fpdData.segment = (fpdData.segment || []).concat(segments);
});
}
} catch (err) {
utils.logError(ERR_MSG);
utils.logError(err.message);
}

try {
Expand All @@ -80,7 +78,7 @@ export function addSegmentData(adUnits, segmentData, config) {
}
}
} catch (err) {
utils.logError(ERR_MSG);
utils.logError(err.message);
}
});
}
Expand Down Expand Up @@ -114,10 +112,6 @@ export function getSegments(reqBidsConfigObj, onDone, config, userConsent) {
}

const userIds = (getGlobal()).getUserIds();
if (typeof userIds == 'undefined' || userIds == null) {
onDone();
return;
}

let haloId = storage.getDataFromLocalStorage(HALOID_LOCAL_NAME);
if (haloId) {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/haloRtdProvider_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HALOID_LOCAL_NAME, SEG_LOCAL_NAME, addSegmentData, getSegments, getSegmentsAsync, haloSubmodule, storage } from 'modules/haloRtdProvider.js';
import { HALOID_LOCAL_NAME, SEG_LOCAL_NAME, addSegmentData, getSegments, haloSubmodule, storage } from 'modules/haloRtdProvider.js';
import { server } from 'test/mocks/xhr.js';

const responseHeader = {'Content-Type': 'application/json'};
Expand Down