Skip to content

Comments

Core: migrate deprecated GPT targeting API usage to config APIs#14495

Open
patmmccann wants to merge 2 commits intomasterfrom
codex/fix-github-issue-#14068
Open

Core: migrate deprecated GPT targeting API usage to config APIs#14495
patmmccann wants to merge 2 commits intomasterfrom
codex/fix-github-issue-#14068

Conversation

@patmmccann
Copy link
Collaborator

@patmmccann patmmccann commented Feb 20, 2026

partial solution to #14068

Motivation

  • Replace uses of deprecated GPT targeting APIs (like pubads().setTargeting / slot.getTargeting) with the modern googletag.setConfig / slot.getConfig('targeting') pattern to follow the upstream GPT changes and avoid runtime deprecation.

Description

  • Updated the GPT key/value helper setKeyValue to prefer googletag.setConfig({targeting}) and fall back to legacy pubads().setTargeting when unavailable, normalizing values to arrays before setting them (libraries/gptUtils/gptUtils.js).
  • Changed targeting reads in GAM reporting to prefer slot.getConfig('targeting') with a backward-compatible fallback to slot.getTargeting/getTargetingKeys (libraries/intentIqUtils/gamPredictionReport.js).
  • Updated macro expansion to read targeting from slot.getConfig('targeting') and fallback to legacy getters when necessary (libraries/browsiUtils/browsiUtils.js).
  • Switched Sirdata RTD to check for slot.setConfig capability (instead of setTargeting) before applying slot-level targeting (modules/sirdataRtdProvider.js).
  • Modernized the test GPT faker to use an object-backed targeting model and to implement getConfig/setConfig semantics; adjusted one test assertion to align with the updated faker behavior (test/spec/integration/faker/googletag.js, test/spec/modules/browsiRtdProvider_spec.js).
  • This change keeps backward compatibility via fallbacks and addresses deprecated API usage; it fixes Issue Replace the usage of the deprecated googletag methods with the updated versions #14068.

Testing

  • Ran npx eslint --cache --cache-strategy content on the modified files and the linter completed successfully.
  • Ran npx gulp test --nolint --file test/spec/libraries/gptUtils_spec.js and the spec passed.
  • Ran npx gulp test --nolint --file test/spec/modules/browsiRtdProvider_spec.js and the spec passed after aligning the test faker behavior.
  • Ran npx gulp test --nolint --file test/spec/modules/sirdataRtdProvider_spec.js and the spec passed.
  • Ran npx gulp lint which completed successfully.

Codex Task

window.googletag.setConfig({targeting: {[key]: values}});
return;
}
window.googletag.pubads().setTargeting?.(key, value);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@codex why is this still using the deprecated method?

Choose a reason for hiding this comment

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

Summary

  • Updated setKeyValue to remove the remaining deprecated googletag.pubads().setTargeting fallback; it now only applies page-level targeting through googletag.setConfig({targeting}). libraries/gptUtils/gptUtils.jsL22-L31
  • Added focused unit tests for setKeyValue to verify both the setConfig path and that no deprecated fallback is invoked when setConfig is 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.”

View task →

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: 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".

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant