Core: migrate deprecated GPT targeting API usage to config APIs#14495
Open
patmmccann wants to merge 2 commits intomasterfrom
Open
Core: migrate deprecated GPT targeting API usage to config APIs#14495patmmccann wants to merge 2 commits intomasterfrom
patmmccann wants to merge 2 commits intomasterfrom
Conversation
patmmccann
commented
Feb 20, 2026
libraries/gptUtils/gptUtils.js
Outdated
| window.googletag.setConfig({targeting: {[key]: values}}); | ||
| return; | ||
| } | ||
| window.googletag.pubads().setTargeting?.(key, value); |
Collaborator
Author
There was a problem hiding this comment.
@codex why is this still using the deprecated method?
There was a problem hiding this comment.
Summary
- Updated
setKeyValueto remove the remaining deprecatedgoogletag.pubads().setTargetingfallback; it now only applies page-level targeting throughgoogletag.setConfig({targeting}). libraries/gptUtils/gptUtils.jsL22-L31 - Added focused unit tests for
setKeyValueto verify both thesetConfigpath and that no deprecated fallback is invoked whensetConfigis unavailable. test/spec/libraries/gptUtils_spec.jsL22-L43 - Committed as:
51b1b42(Core: remove deprecated GPT targeting fallback in gptUtils).
Testing
- ✅
npx eslint --cache --cache-strategy content libraries/gptUtils/gptUtils.js test/spec/libraries/gptUtils_spec.js - ✅
npx gulp test --nolint --file test/spec/libraries/gptUtils_spec.js
Also completed the required follow-up PR creation via make_pr with title: “Core: remove remaining deprecated GPT setTargeting fallback.”
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 350eb01345
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
partial solution to #14068
Motivation
pubads().setTargeting/slot.getTargeting) with the moderngoogletag.setConfig/slot.getConfig('targeting')pattern to follow the upstream GPT changes and avoid runtime deprecation.Description
setKeyValueto prefergoogletag.setConfig({targeting})and fall back to legacypubads().setTargetingwhen unavailable, normalizing values to arrays before setting them (libraries/gptUtils/gptUtils.js).slot.getConfig('targeting')with a backward-compatible fallback toslot.getTargeting/getTargetingKeys(libraries/intentIqUtils/gamPredictionReport.js).slot.getConfig('targeting')and fallback to legacy getters when necessary (libraries/browsiUtils/browsiUtils.js).slot.setConfigcapability (instead ofsetTargeting) before applying slot-level targeting (modules/sirdataRtdProvider.js).targetingmodel and to implementgetConfig/setConfigsemantics; adjusted one test assertion to align with the updated faker behavior (test/spec/integration/faker/googletag.js,test/spec/modules/browsiRtdProvider_spec.js).Testing
npx eslint --cache --cache-strategy contenton the modified files and the linter completed successfully.npx gulp test --nolint --file test/spec/libraries/gptUtils_spec.jsand the spec passed.npx gulp test --nolint --file test/spec/modules/browsiRtdProvider_spec.jsand the spec passed after aligning the test faker behavior.npx gulp test --nolint --file test/spec/modules/sirdataRtdProvider_spec.jsand the spec passed.npx gulp lintwhich completed successfully.Codex Task