Skip to content

feat(Rtd): add a flag to disable the filtering of rtd module #7

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion modules/greenbidsRtdProvider.js
Original file line number Diff line number Diff line change
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_disabled_filtering');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stay consistent with the other parameter name.

Suggested change
const isFilteringDisabled = getParameterByName('greenbids_disabled_filtering');
const isFilteringDisabled = getParameterByName('greenbids_disable_filtering');

adUnits.forEach((adUnit) => {
const matchingAdUnit = findMatchingAdUnit(responseAdUnits, adUnit.code);
if (matchingAdUnit) {
Expand All @@ -96,7 +97,7 @@ function updateAdUnitsBasedOnResponse(adUnits, responseAdUnits, greenbidsId) {
if (isFilteringForced) {
adUnit.bids = [];
logInfo('Greenbids Rtd: filtering flag detected, forcing filtering of Rtd module.');
} else if (!matchingAdUnit.isExploration) {
} else if (!matchingAdUnit.isExploration & !isFilteringDisabled) {
removeFalseBidders(adUnit, matchingAdUnit);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: may I ask to rewrite the condition to make it more straight forward?

Suggested change
if (isFilteringForced) {
adUnit.bids = [];
logInfo('Greenbids Rtd: filtering flag detected, forcing filtering of Rtd module.');
} else if (!matchingAdUnit.isExploration) {
} else if (!matchingAdUnit.isExploration & !isFilteringDisabled) {
removeFalseBidders(adUnit, matchingAdUnit);
}
if (matchingAdUnit.isExploration || isFilteringDisabled) return; // Or you may log something
if (isFilteringForced) {
...
} else {
removeFalseBidders(...);
}

}
Expand Down