Skip to content

Comments

Prebid 11: gpt slots matching to ad units logic unification#14480

Open
mkomorski wants to merge 4 commits intoprebid-11.0from
mkomorski/gpt-viewability
Open

Prebid 11: gpt slots matching to ad units logic unification#14480
mkomorski wants to merge 4 commits intoprebid-11.0from
mkomorski/gpt-viewability

Conversation

@mkomorski
Copy link
Collaborator

@mkomorski mkomorski commented Feb 17, 2026

This PR unifies matching gpt slots to ad units logic between adapters (gptUtils), targeting, bidViewabillity and gptPreAuction modules. Introduces new config param customGptSlotMatching

Type of change

  • Bugfix

  • Feature

  • New bidder adapter

  • Updated bidder adapter

  • Code style update (formatting, local variables)

  • Refactoring (no functional changes, no api changes)

  • Build related changes

  • CI related changes

  • Does this change affect user-facing APIs or examples documented on http://prebid.org?

  • Other

Description of change

Other information

#14408

@mkomorski mkomorski marked this pull request as ready for review February 17, 2026 15:27
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: de7e592a3d

ℹ️ 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".

return;
}
targeting.setTargetingForGPT(adUnit, customSlotMatching);
targeting.setTargetingForGPT(adUnit);

Choose a reason for hiding this comment

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

P1 Badge Preserve custom slot matcher arg in setTargetingForGPTAsync

This removes the per-call matcher from pbjs.setTargetingForGPTAsync, so integrations that currently call setTargetingForGPTAsync(adUnits, matcher) will silently fall back to default slot/path matching. On pages with duplicate adUnit.code values, that can target the wrong GPT slot and send incorrect key-values to GAM. Please keep backward compatibility by honoring the second argument (or mapping it to the new global matcher path).

Useful? React with 👍 / 👎.

Comment on lines +19 to +23
export const getMatchingWinningBidForGPTSlot = (slot) => {
const match = isAdUnitCodeMatchingSlot(slot);
return getGlobal().getAllWinningBids().find(
// supports custom match function from config
bid => isFn(globalModuleConfig[CONFIG_CUSTOM_MATCH])
? globalModuleConfig[CONFIG_CUSTOM_MATCH](bid, slot)
: isBidAdUnitCodeMatchingSlot(bid, slot)
({ adUnitCode }) => match(adUnitCode)

Choose a reason for hiding this comment

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

P1 Badge Keep bidViewability customMatchFunction compatibility

getMatchingWinningBidForGPTSlot no longer evaluates bidViewability.customMatchFunction, so existing configs that relied on that hook now cannot customize bid↔slot matching. In those deployments, slots that only matched via the custom function will now return null, which suppresses BID_VIEWABLE emission and viewability pixel firing for otherwise valid impressions. Consider preserving the old module-level matcher as a fallback.

Useful? React with 👍 / 👎.

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: de7e592a3d

ℹ️ 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".

return;
}
targeting.setTargetingForGPT(adUnit, customSlotMatching);
targeting.setTargetingForGPT(adUnit);

Choose a reason for hiding this comment

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

P2 Badge Keep custom slot matcher support in setTargetingForGPTAsync

This call now always invokes targeting.setTargetingForGPT(adUnit) and no longer forwards a caller-provided matcher, so existing integrations that pass a per-call custom matcher (used when multiple GPT slots share an adUnit code) will silently fall back to default path/id matching and can set targeting on the wrong slot. Please preserve the second-argument behavior (or a compatibility fallback) to avoid breaking current publisher implementations.

Useful? React with 👍 / 👎.

@coveralls
Copy link
Collaborator

coveralls commented Feb 17, 2026

Pull Request Test Coverage Report for Build 22109419656

Details

  • 50 of 50 (100.0%) changed or added relevant lines in 10 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.001%) to 96.211%

Files with Coverage Reduction New Missed Lines %
test/spec/modules/bidViewability_spec.js 1 99.34%
test/spec/modules/id5AnalyticsAdapter_spec.js 1 96.13%
Totals Coverage Status
Change from base Build 21926473833: -0.001%
Covered Lines: 208142
Relevant Lines: 216338

💛 - Coveralls

@dgirardi dgirardi changed the base branch from adUnit-elementSelector to prebid-11.0 February 18, 2026 19:03
@dgirardi dgirardi changed the base branch from prebid-11.0 to adUnit-elementSelector February 18, 2026 19:03
@mkomorski mkomorski force-pushed the mkomorski/gpt-viewability branch from e71919d to 7333bf8 Compare February 19, 2026 11:01
@mkomorski mkomorski changed the base branch from adUnit-elementSelector to prebid-11.0 February 19, 2026 11:01
@mkomorski mkomorski force-pushed the mkomorski/gpt-viewability branch from 7333bf8 to 6e3fe2d Compare February 19, 2026 11:12
@mkomorski mkomorski changed the title Core: gpt slots matching to ad units logic unification Prebid 11: gpt slots matching to ad units logic unification Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants