Skip to content

Commit

Permalink
Bid Glass Adapter: Merge externally set targeting params (#6426)
Browse files Browse the repository at this point in the history
* Added bidglass adapter + test

* PR Review Updates:

- Added formal params to getUserSyncs function definition
- getUserSyncs now always returns an array
- Improved unit test coverage

* PR Review Updates:

- Removed unused methods: getUserSyncs, onTimeout, onBidWon,
onSetTargeting
- Removed getUserSyncs unit test
- Removed "dead code"
- Removed some unnecessary comments
- Fixed usage of parseInt

* Bid Glass Bid Adapter: pass options in bid request

* Merge externally set targeting params

* Updates to address gulp errors

* Get `bidglass` reference from window
  • Loading branch information
dliebner committed Mar 24, 2021
1 parent fa5c978 commit 1dc7c05
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/bidglassBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,29 @@ export const spec = {
return ori;
};

let bidglass = window['bidglass'];

utils._each(validBidRequests, function(bid) {
bid.sizes = ((utils.isArray(bid.sizes) && utils.isArray(bid.sizes[0])) ? bid.sizes : [bid.sizes]);
bid.sizes = bid.sizes.filter(size => utils.isArray(size));

var adUnitId = utils.getBidIdParameter('adUnitId', bid.params);
var options = utils.deepClone(bid.params);

delete options.adUnitId;

// Merge externally set targeting params
if (typeof bidglass === 'object' && bidglass.getTargeting) {
let targeting = bidglass.getTargeting(adUnitId, options.targeting);

if (targeting && Object.keys(targeting).length > 0) options.targeting = targeting;
}

// Stuff to send: [bid id, sizes, adUnitId, options]
imps.push({
bidId: bid.bidId,
sizes: bid.sizes,
adUnitId: utils.getBidIdParameter('adUnitId', bid.params),
adUnitId: adUnitId,
options: options
});
});
Expand Down

0 comments on commit 1dc7c05

Please sign in to comment.