Skip to content

Commit

Permalink
GumGum Bid Adapter: Send new tpl paramter which is topmostLocation (#…
Browse files Browse the repository at this point in the history
…12069)

* I added a new wl parameter to the payload.

* Changed wl parameter name to tpl and pulled the data from topmostLocation
  • Loading branch information
MartinGumGum authored Aug 5, 2024
1 parent 781787e commit 7f15127
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ let invalidRequestIds = {};
let pageViewId = null;

// TODO: potential 0 values for browserParams sent to ad server
function _getBrowserParams(topWindowUrl) {
function _getBrowserParams(topWindowUrl, mosttopLocation) {
const paramRegex = paramName => new RegExp(`[?#&](${paramName}=(.*?))($|&)`, 'i');

let browserParams = {};
let topWindow;
let topScreen;
let topUrl;
let mosttopURL
let ggad;
let ggdeal;
let ns;
Expand Down Expand Up @@ -74,6 +75,7 @@ function _getBrowserParams(topWindowUrl) {
topWindow = global.top;
topScreen = topWindow.screen;
topUrl = topWindowUrl || '';
mosttopURL = mosttopLocation || '';
} catch (error) {
logError(error);
return browserParams;
Expand All @@ -85,6 +87,7 @@ function _getBrowserParams(topWindowUrl) {
sw: topScreen.width,
sh: topScreen.height,
pu: stripGGParams(topUrl),
tpl: mosttopURL,
ce: storage.cookiesAreEnabled(),
dpr: topWindow.devicePixelRatio || 1,
jcsi: JSON.stringify(JCSI),
Expand Down Expand Up @@ -304,6 +307,7 @@ function buildRequests(validBidRequests, bidderRequest) {
const timeout = bidderRequest && bidderRequest.timeout
const coppa = config.getConfig('coppa') === true ? 1 : 0;
const topWindowUrl = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page;
const mosttopLocation = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.topmostLocation
_each(validBidRequests, bidRequest => {
const {
bidId,
Expand Down Expand Up @@ -443,7 +447,7 @@ function buildRequests(validBidRequests, bidderRequest) {
sizes,
url: BID_ENDPOINT,
method: 'GET',
data: Object.assign(data, _getBrowserParams(topWindowUrl))
data: Object.assign(data, _getBrowserParams(topWindowUrl, mosttopLocation))
});
});
return bids;
Expand Down

0 comments on commit 7f15127

Please sign in to comment.