Skip to content

Commit

Permalink
Merge pull request #5 from guardian/kc-pvid
Browse files Browse the repository at this point in the history
Add pageview ID to Sonobi bids
  • Loading branch information
kelvin-chappell authored Feb 6, 2018
2 parents ad97abe + 2a7ed50 commit bde021a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions build/dist/prebid.js

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ var SonobiAdapter = function SonobiAdapter() {
var adSlots = request.bids || [];
var bidderRequestId = request.bidderRequestId;
var ref = '&ref=' + encodeURI(utils.getTopWindowLocation().host);
const appNexusTargeting =
adSlots[0] && adSlots[0].params && adSlots[0].params.appNexusTargeting ? '&gmgt=' + encodeURI(adSlots[0].params.appNexusTargeting) : '';
adloader.loadScript(trinity + JSON.stringify(_keymaker(adSlots)) + '&cv=' + _operator(bidderRequestId) + ref + appNexusTargeting);
const appNexusTargeting = _buildTargetingIfPresent(adSlots[0], 'gmgt', 'appNexusTargeting');
const pageViewId = _buildTargetingIfPresent(adSlots[0], 'pv', 'pageViewId');
adloader.loadScript(trinity + JSON.stringify(_keymaker(adSlots)) + '&cv=' + _operator(bidderRequestId) + ref + appNexusTargeting + pageViewId);
}

function _buildTargetingIfPresent(bid, targetingKey, paramKey) {
return bid && bid.params && bid.params[paramKey] ? '&' + targetingKey + '=' + encodeURI(bid.params[paramKey]) : '';
}

function _keymaker(adSlots) {
Expand Down

0 comments on commit bde021a

Please sign in to comment.