Skip to content

Commit

Permalink
Greenbids RTD Module : add flag to disable filtering (prebid#12331)
Browse files Browse the repository at this point in the history
* feat(Rtd): add a flag to disable the filtering of rtd module

* review

* add log

* modify log level

* Refresh CI
  • Loading branch information
maelmrgt authored Oct 18, 2024
1 parent 1fed96d commit 22a169f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/greenbidsRtdProvider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logError, logInfo, logWarn, deepClone, generateUUID, deepSetValue, deepAccess, getParameterByName } from '../src/utils.js';
import { logError, logInfo, logWarn, logMessage, deepClone, generateUUID, deepSetValue, deepAccess, getParameterByName } from '../src/utils.js';
import { ajax } from '../src/ajax.js';
import { submodule } from '../src/hook.js';
import * as events from '../src/events.js';
Expand Down Expand Up @@ -85,6 +85,7 @@ function processSuccessResponse(response, timeoutId, reqBidsConfigObj, greenbids

function updateAdUnitsBasedOnResponse(adUnits, responseAdUnits, greenbidsId) {
const isFilteringForced = getParameterByName('greenbids_force_filtering');
const isFilteringDisabled = getParameterByName('greenbids_disable_filtering');
adUnits.forEach((adUnit) => {
const matchingAdUnit = findMatchingAdUnit(responseAdUnits, adUnit.code);
if (matchingAdUnit) {
Expand All @@ -93,10 +94,12 @@ function updateAdUnitsBasedOnResponse(adUnits, responseAdUnits, greenbidsId) {
keptInAuction: matchingAdUnit.bidders,
isExploration: matchingAdUnit.isExploration
});
if (isFilteringForced) {
if (matchingAdUnit.isExploration || isFilteringDisabled) {
logMessage('Greenbids Rtd: either exploration traffic, or disabled filtering flag detected');
} else if (isFilteringForced) {
adUnit.bids = [];
logInfo('Greenbids Rtd: filtering flag detected, forcing filtering of Rtd module.');
} else if (!matchingAdUnit.isExploration) {
} else {
removeFalseBidders(adUnit, matchingAdUnit);
}
}
Expand Down

0 comments on commit 22a169f

Please sign in to comment.