Skip to content

Comments

Core: bid targeting exclusion#14453

Open
mkomorski wants to merge 3 commits intomasterfrom
mkomorski/bid-targeting-exclusion
Open

Core: bid targeting exclusion#14453
mkomorski wants to merge 3 commits intomasterfrom
mkomorski/bid-targeting-exclusion

Conversation

@mkomorski
Copy link
Collaborator

@mkomorski mkomorski commented Feb 11, 2026

Type of change

  • Feature

Description of change

Bid targeting exclusion (bidTargetingExclusion)

Summary

Adds a new config option bidTargetingExclusion that lets you control which bids are included in ad server targeting (e.g. setTargetingForGPT). You can exclude specific bids from targeting (e.g. ineligible or unwanted bids).

Configuration

pbjs.setConfig({
  bidTargetingExclusion: (bid) => {
    return isEligible(bid);  // true = bid included in targeting, false = bid excluded
  }
});

Other information

#12399

@mkomorski mkomorski marked this pull request as ready for review February 11, 2026 12:00
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c2695fb99

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

src/targeting.ts Outdated
const adUnitIsEligible = adUnitCodes.includes(bid.adUnitCode);
const cpmAllowed = bidderSettings.get(bid.bidderCode, 'allowZeroCpmBids') === true ? bid.cpm >= 0 : bid.cpm > 0;
const isPreferredDeal = alwaysIncludeDeals && bid.dealId;
const notExcludedByConfig = bidTargetingExclusion?.(bid) !== false;

Choose a reason for hiding this comment

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

P2 Badge Validate bidTargetingExclusion is callable before invoking

bidTargetingExclusion?.(bid) still throws when the config value is non-nullish but not a function (for example true or {}), because optional-call only short-circuits null/undefined. Since setConfig accepts arbitrary values, a malformed publisher config can now raise a TypeError inside targeting generation and prevent ad-server targeting from being produced for that page; add a typeof bidTargetingExclusion === 'function' guard (or equivalent config validation) before calling it.

Useful? React with 👍 / 👎.

Copy link
Collaborator

Choose a reason for hiding this comment

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

lets add the type check and also run the three filters and pass the remaining bids as a second argumernt to the exclusion function so the function can do comparisons of various bids

@coveralls
Copy link
Collaborator

coveralls commented Feb 11, 2026

Pull Request Test Coverage Report for Build 22059275916

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 42 of 42 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage remained the same at 96.244%

Files with Coverage Reduction New Missed Lines %
test/spec/modules/id5AnalyticsAdapter_spec.js 1 96.13%
Totals Coverage Status
Change from base Build 21911990972: 0.0%
Covered Lines: 211745
Relevant Lines: 220008

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants