Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Greenbids RTD Module : add flag to disable filtering #12331

Merged
merged 5 commits into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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