Prebid 11: add adUnit.element option#14467
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d7932f800
ℹ️ 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".
|
Missed this, will start review this tomorrow |
monis0395
left a comment
There was a problem hiding this comment.
@dgirardi Is the GPT slot fallback for getAdUnitElement intentionally deferred to a follow-up PR (per the TODO on line 5-6 of src/utils/adUnits.ts)? Several adapters still independently implement GPT fallback after calling getAdUnitElement (33across, ix, visx, underdogmedia, valuad, fan, medianet), so it'd be great to confirm this is planned for unification in a subsequent PR.
Also a lot of adapters can use getAdUnitElement(adUnitCode) for replacement of document.getElementById(bidReq.adUnitCode) is that also intentionally left ?
is the todo addressed in #14480 ? That's based on this |
…into adUnit-elementSelector
Currently #14480 does not attempt to unify them and I'm not sure it will, so I removed the TODO for now. It's still an option if we decide to attempt it, but since writing that comment I realized it's a much bigger task than we were originally signing up for. There's quite a few adapters that have surprisingly complicated logic; I'd love to simplify it but it's also not clear that doing so would benefit publishers enough, compared to the risk of some adapters picking up the new unified logic as "your viewability is now lower".
The goal of this PR is to replace the latter with the former. I left some of the "old" use in when the replacement would not have been functionally equivalent, and added a TODO comment in those cases. Is that what you're referring to? If not, it's not intentional, please do point out what I missed. |
Makes sense. Agreed, it’s a much bigger task. One question: is #14480 branched off this PR? I assumed it would be. Ideally #14480 should build on top of this PR’s getAdUnitElement rather than exist as a sibling, to avoid conflicts and to ensure the GPT unification uses the new element resolution path.
Correct
Examples I noticed
|
Type of change
Description of change
elementoption to ad units that can be used to associate it with a DOM elementgetAdUnitElement(adUnit | bidRequest | bidResponse)utility function that returns the DOM element associated with a given ad unit / bid request / bid responseadUnit.elementis not specified, defaults togetElementById(adUnit.code)document.getElementById(adUnit.code)intogetAdUnitElement(adUnit). In some cases the logic was too complex for a simple refactor; I noted those with a TODO commentOther information
Related: #14408 and #13125