Skip to content

Commit

Permalink
Fixes prebid#998 Allow keyvalues, gender and age to be passed in PubM…
Browse files Browse the repository at this point in the history
…atic's adapter
  • Loading branch information
ptomasroos committed May 19, 2017
1 parent baff871 commit 495b2c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/adapters/pubmatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ var PubmaticAdapter = function PubmaticAdapter() {
var bid = bids[i];
// bidmanager.pbCallbackMap['' + bid.params.adSlot] = bid;
_pm_pub_id = _pm_pub_id || bid.params.publisherId;
_pm_pub_age = _pm_pub_age || (bid.params.age || "");
_pm_pub_gender = _pm_pub_gender || (bid.params.gender || "");
_pm_pub_kvs = _pm_pub_kvs || (bid.params.kvs || "");
_pm_optimize_adslots.push(bid.params.adSlot);
}

Expand Down Expand Up @@ -51,11 +54,18 @@ var PubmaticAdapter = function PubmaticAdapter() {
content += '' +
'window.pm_pub_id = "%%PM_PUB_ID%%";' +
'window.pm_optimize_adslots = [%%PM_OPTIMIZE_ADSLOTS%%];' +
'window.kaddctr = "%%PM_ADDCTR%%;"' +
'window.kadgender = "%%PM_GENDER%%;"' +
'window.kadage = "%%PM_AGE%%;"' +
'window.pm_async_callback_fn = "window.parent.$$PREBID_GLOBAL$$.handlePubmaticCallback";';

content += '</scr' + 'ipt>';

var map = {};
map.PM_PUB_ID = _pm_pub_id;
map.PM_ADDCTR = _pm_pub_kvs;
map.PM_GENDER = _pm_pub_gender;
map.PM_AGE = _pm_pub_age;
map.PM_OPTIMIZE_ADSLOTS = _pm_optimize_adslots.map(function (adSlot) {
return "'" + adSlot + "'";
}).join(',');
Expand Down

0 comments on commit 495b2c6

Please sign in to comment.