Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airgridRtdProvider: use provided tag insertion method loadExternalScript #9901

Merged
merged 16 commits into from
Jun 1, 2023

Conversation

naripok
Copy link
Contributor

@naripok naripok commented May 3, 2023

Type of change

  • Feature
  • New 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

Use loadExternalScript instead of appendChild to insert the ad tag.
Fixes issue #8421

CC @ydennisy

@naripok naripok marked this pull request as draft May 4, 2023 19:36
@naripok naripok marked this pull request as ready for review May 4, 2023 19:36
@naripok naripok marked this pull request as draft May 4, 2023 19:47
@naripok
Copy link
Contributor Author

naripok commented May 5, 2023

Seems like our changes are breaking a seemingly unrelated module (mass).
I looked around and can't make sense of how the changes here would affect this module in particular.
Maybe somebody has a good hint/insight about how to fix it?

The test error message:

SUMMARY:
✔ 12427 tests completed
✖ 1 test failed

FAILED TESTS:
  MASS Module
    ✖ should have a default renderer
      Chrome Headless 113.0.5672.63 (Linux x86_64)
    TypeError: Cannot read properties of undefined (reading 'parentNode')
        at render (/tmp/_karma_webpack_879703/commons.js:96375:9)
        at Context.<anonymous> (/tmp/_karma_webpack_879703/commons.js:308431:5)

[11:29:18] 'test-all-features-disabled' errored after 1.13 min
[11:29:18] Error: Karma tests failed with exit code 1
    at ChildProcess.<anonymous> (/home/tau/Projects/airgrid/Prebid.js/gulpfile.js:342:12)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:552:15)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at Process.callbackTrampoline (node:internal/async_hooks:130:17)
[11:29:18] 'test' errored after 1.78 min

@patmmccann
Copy link
Collaborator

@dgirardi could you assist this commiter?

@ydennisy
Copy link
Contributor

@naripok we have had some feedback that we should be updating bid request object in a different way.

Ref: https://docs.prebid.org/dev-docs/add-rtd-submodule.html#reqBidsConfigObj

  • Recommended: use one of these First Party Data conventions
  • For global first party data, including bidder-specific data, modify the reqBidsConfigObj as shown below

@dgirardi dgirardi mentioned this pull request May 11, 2023
1 task
@dgirardi
Copy link
Collaborator

The MASS test failure should be fixed with #9939

@naripok
Copy link
Contributor Author

naripok commented May 11, 2023

The MASS test failure should be fixed with #9939

Thank you so much @dgirardi!

@dgirardi
Copy link
Collaborator

Regarding how to pass audience data to bidders, I believe you had it very close in an old version:

https://github.com/AirGrid/Prebid.js/blame/0eb76d7620c3bfccd254340fbc189985373fda07/modules/airgridRtdProvider.js

where that is modifying the ortb2Fragments parameter in the way recommended by the docs; the only missing piece is what to do about appnexus - since it does not understand user.ext.data.

My suggestion is to restore the old logic setting user.ext.data (without using mergeBidderConfig), and expand it to also update user.keywords with the appnexus-specific perid=<audienceId>.

feat: extend module data setting using `user.keywords` for appnexus
@naripok naripok requested a review from ydennisy May 15, 2023 16:46
@naripok naripok marked this pull request as ready for review May 15, 2023 16:46
@naripok
Copy link
Contributor Author

naripok commented May 15, 2023

Regarding how to pass audience data to bidders, I believe you had it very close in an old version:

https://github.com/AirGrid/Prebid.js/blame/0eb76d7620c3bfccd254340fbc189985373fda07/modules/airgridRtdProvider.js

where that is modifying the ortb2Fragments parameter in the way recommended by the docs; the only missing piece is what to do about appnexus - since it does not understand user.ext.data.

My suggestion is to restore the old logic setting user.ext.data (without using mergeBidderConfig), and expand it to also update user.keywords with the appnexus-specific perid=<audienceId>.

Thank you very much for the help, @dgirardi.
I've restored the old logic and extended it for setting ortb2.user.keywords with the appnexus values, removing mergeBidderConfig usage.
If you have a second, would you let me know if it looks good?
@ydennisy, please, take a look too if you can.

const bidders = deepAccess(rtdConfig, 'params.bidders');
if (!bidders || bidders.length === 0 || !audiences || audiences.length === 0) return;

const agOrtb2 = {}
deepSetValue(agOrtb2, 'ortb2.user.ext.data.airgrid', audiences);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is out of spec - data should be an array, sorry for not catching this earlier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I saw it and missed anyway...
Thank you for the catch! Let me fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wait, sorry about the confusion @dgirardi, but we're using user.ext.data here, not user.data, which is an array.
Should we be using user.data instead?
I saw it was present here as an obj and we were using it also in the previous implementation, but I'm not sure anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

user.ext.data is the safer choice, it has been "promoted" to user.data in ORTB version 2.6 but afaik that hasn't been widely adopted yet.

Copy link
Contributor Author

@naripok naripok May 15, 2023

Choose a reason for hiding this comment

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

Thanks for the explanation!
Does this mean that we're good, then? 😅

Copy link
Collaborator

Choose a reason for hiding this comment

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

No objection to forking the PR, but I'd prefer then if you rolled this back to just the loadExternalScript change so that the incorrect values in user.ext are not forgotten.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dgirardi, I've reverted the data setting changes so this PR includes only the loadExternalScript changes.

Now, for the data setting method, as per last feedback, I understand that the changes introduced in this PR are bad, and we should revert those to the previous setting method, right?
I'm just a little bit confused with all the back and forth we had, so, I'm sorry to ask, but could you please again be very specific in which should be the desired data setting method you'd like to see for the next PR?
Is this the preferred way to go forward?

Copy link
Collaborator

Choose a reason for hiding this comment

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

the method is the one you just had in the previous commit, with the difference that the data should be formatted as a ORTB user.data segment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, alright, got ya!
Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dgirardi, I've pushed the data setting changes to a PR in our fork here. I'll open a PR here once I know it is good and we have this PR merged.
Would you mind checking out the question in this comment, please?
I'm doing some guesswork there, and it would be great to have some confirmation that I'm getting it right.
Thank you very much!

@ydennisy
Copy link
Contributor

@naripok I think we should mark this as draft.

@naripok naripok marked this pull request as draft May 16, 2023 12:31
@naripok naripok marked this pull request as ready for review May 18, 2023 13:49
@naripok naripok requested a review from dgirardi May 18, 2023 14:22
@patmmccann
Copy link
Collaborator

@naripok please resolve conflicts

@naripok
Copy link
Contributor Author

naripok commented May 26, 2023

@naripok please resolve conflicts

@patmmccann Done :)

@patmmccann patmmccann merged commit 27ea1ad into prebid:master Jun 1, 2023
mscottnelson added a commit to 33Across/Prebid.js that referenced this pull request Jun 15, 2023
* master:
  Colossus Bid Adapter: gpp support (prebid#10096)
  Increment version to 8.1.0-pre
  Prebid 8.0.0 release
  Prebid 8: initial release (prebid#10071)
  Increment version to 7.54.1-pre
  Prebid 7.54.0 release
  Update topicsFpdModule.js (prebid#9990)
  Added GPP support (prebid#10094)
  Teads Bid Adapter:Remove auctionId from since it is not used anymore  (prebid#10098)
  HypeLab Bid Adapter: Initial Release (prebid#10003)
  Oxxion Rtd Module: listen onBidResponseEvent instead of onAuctionEndEvent (prebid#10083)
  PubMatic Analytics Adapter : Added extra fields in tracker for analytics (prebid#10090)
  AdHash Bidder Adapter: update for brand safety (prebid#10087)
  videojsVideoProvider: use contrib-ads event names (prebid#10081)
  Increment version to 7.54.0-pre
  Prebid 7.53.0 release
  Add bidgency alias (prebid#10077)
  Weborama RTD Module : start Bidder specific handling removal (prebid#10005)
  ZetaGlobalSspBidAdapter: change logic around mediaType (prebid#10074)
  add tmax to sovrnBidAdapter (prebid#10059)
  Mediasquare Bid Adapter: Avoid to run bidwon event on video impressions (prebid#10068)
  FreePass User ID Module : initial release (prebid#9814)
  Conceptx Bid Adapter : initial release (prebid#9835)
  beOp BidAdapter: FirstPartyData management and ingest Permutive segments (prebid#9947)
  StroeerCore Bid Adapter: add price floor support (prebid#9962)
  YieldlabBidAdapter updated native asset mapping (prebid#9989)
  Mediasquare Bid Adapter: handle context for video bids (prebid#10055)
  Add new alias - Apester (prebid#10057)
  Criteo Bid Adapter: Pass outstream video renderer method (prebid#10054)
  Add: Viously GVL ID (prebid#10061)
  1plus x RTD Adapter: remove bidder specific handling enforcement (DC 3634) (prebid#10001)
  Sirdata RTD Module : bidder specific handling removal (prebid#9970)
  feat: pass video.plcmt [PB-1736] (prebid#10058)
  Update adkernelBidAdapter.js (prebid#10056)
  Eskimi Bid Adapter: Added support for video (prebid#9985)
  Richaudience Bid Adapter : add compability with GPID (prebid#9928)
  Add GVL ID for pairId userId submodule. (prebid#10053)
  Update nexx360BidAdapter.js (prebid#10042)
  Logicad Bid Adapter: Add topics and uach support (prebid#10045)
  change session_id fallback to bidderRequestId (prebid#10047)
  ZetaGlobalSsp Bid Adapter : process array of sizes (prebid#10039)
  AdagioBidAdapter: change outstream renderer (prebid#10035)
  update greenbids analytics endpoint (prebid#10037)
  ID5 User Id module - get whole ext object from server response (prebid#10036)
  Criteo Bid Adapter : Bump fastbid version to 136 (prebid#9973)
  UID2 & EUID Modules: Add support for EUID and prefer localStorage for both modules. (prebid#9968)
  Schain module: do not share schain objects across different bid requests (prebid#10021)
  airgridRtdProvider: use provided tag insertion method `loadExternalScript` (prebid#9901)
  Increment version to 7.53.0-pre
  Prebid 7.52.0 release
  Yahoo ConnectId - fixed tests. (prebid#10033)
  Core & Multiple modules: activity controls (prebid#9802)
  Yahoo ConnectId - gpp consent module usage. (prebid#10022)
  Yahoo bid adapter:  User sync pixels, consent signals update (prebid#10028)
  Core: fix `markWinningBidAsUsed` to set bid as winning and not just rendered (prebid#10014)
  Adriver Id System: add cfa param to url (prebid#10024)
  Undertone Bid Adapter : added GPP and video placements (prebid#10016)
  Oxxion Analytics Adapter : initial adapter release (prebid#9682)
  Connect id : storage duration updates and no longer require puid or he to be set (prebid#9965)
  Update ad generation adapter 1.6.0: update userSync (prebid#9984)
  fix module type (prebid#10019)
  Stv Bid Adapter: add schain support (prebid#10010)
  GrowthCode RTD  : initial release (prebid#9852)
  ShareThrough Bid Adapter : fix playerSize (prebid#10011)
  chore: update default video placement value [PB-1560] (prebid#9948)
  Smartadserver Bid Adapter: support GPID (prebid#10004)
  Criteo Adapter: Add support of bcat/badv/bapp (prebid#10013)
  Zeta Global SSP Bid Adapter: Added support for video.plcmt (prebid#10009)
  Pair Id System: less noisy errors (prebid#9998)
  Increment version to 7.52.0-pre
  Prebid 7.51.0 release
  Appnexus Bid Adapter: added uol as an alias (prebid#10002)
  Adquery Bid Adapter : added bid request: version and bidPageUrl (prebid#9946)
  MinuteMedia Bid Adapter: support sua and plcmt params (prebid#9997)
  Adkernel Bid Adapter: add didnadisplay alias (prebid#10000)
  Adrino Bid Adapter: pass adUnitCode to adserver (prebid#9993)
musikele pushed a commit to rubicon-project/Prebid.js that referenced this pull request Aug 28, 2023
…ript` (prebid#9901)

* chore: update `getAudiencesAsBidderOrtb2` implementation and test

* chore: use provided tag insertion method

* fix: add `airgrid` to `_approvedLoadExternalJSList`

* fix: use 'sdk' path if no publisherId is provided

* fix: use accountId as path param for script url

* fix: assign edktInitializor props before `loadExternalScript` call

* fix: set `edktInitializor.invoked` before calling `loadExternalScript`

* fix: restore method for setting `user.ext.data`
feat: extend module data setting using `user.keywords` for appnexus

* fix: rollback changes to data setting method
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.

5 participants