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

Core: unify rendering paths; codify (and test) cross-domain render example #9647

Merged
merged 17 commits into from
Nov 20, 2023

Conversation

dgirardi
Copy link
Collaborator

@dgirardi dgirardi commented Mar 9, 2023

Type of change

  • Feature
  • Refactoring (no functional changes, no api changes)

Description of change

This attempts to unify pbjs.renderAd and "safe creative" rendering so that they share as much code as possible.
Additionally, this adds build/creative/creative.js, an optimized (and tested) version of this cross-domain example. The plan is to eventually re-use this from PUC or its successor.

Other information

Closes #8358
Also related:
#6130
#9060

@ChrisHuie ChrisHuie requested a review from lksharma March 14, 2023 14:15
@ChrisHuie ChrisHuie requested a review from Fawke March 14, 2023 14:15
@ChrisHuie ChrisHuie removed the request for review from Fawke March 17, 2023 14:08
@ChrisHuie ChrisHuie removed the request for review from lksharma March 29, 2023 15:38
@patmmccann patmmccann requested a review from musikele April 4, 2023 17:08
@robertrmartinez robertrmartinez removed their request for review April 26, 2023 16:09
@robertrmartinez robertrmartinez removed their assignment Apr 26, 2023
Copy link
Contributor

@musikele musikele left a comment

Choose a reason for hiding this comment

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

Some comments here and there, you may want to give a look

try {
if (!adId || !doc) {
// eslint-disable-next-line standard/no-callback-literal
cb({
Copy link
Contributor

Choose a reason for hiding this comment

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

we can add return cb({ ... and remove the else after

}
const repl = {
AUCTION_PRICE: originalCpm || cpm,
CLICKTHROUGH: options?.clickUrl || ''
Copy link
Contributor

Choose a reason for hiding this comment

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

I've worked on prebid-unviersal-creative in the past to add clickUrlUnesc variable for native ads: a variable that, if is we are in GAM, it is substituted with GAM's %%CLICK_URL_UNESC%% that can be used in native templates to track clicks on them. This is the PR: prebid/prebid-universal-creative#196
I am adding this comment because we probably may want to unify the two things, in the future...

.pipe(gulp.dest('build/creative'))
}

function updateCreativeExample(cb) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what was the problem you wanted to solve with buildCreative and updateCreative ?

Copy link
Collaborator Author

@dgirardi dgirardi Apr 27, 2023

Choose a reason for hiding this comment

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

they build the creative code and its example page respectively, using "real" code instead of what's in the current example (that means it shares what it can with safeframe / renderAd and is unit-tested).

The alternative is what we have right now - someone occasionally figures out what to put in the example, then we let it drift out of sync with the rest until someone notices something doesn't work anymore.

reply(Object.assign({
message: PREBID_RESPONSE,
}, adData));
}, {options: message.option, adId: message.adId, bidResponse});
}

function handleNativeRequest(reply, data, adObject) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not related to this PR, but file secureCreatives.js is under 75% coverage

@patmmccann
Copy link
Collaborator

@musikele forgive me for having trouble following, have you finished your review and awaiting changes, or are your changes addressed?

events.emit(BID_WON, adObject);
function handleRenderRequest(reply, message, bidResponse) {
handleRender(function (adData) {
resizeRemoteCreative(bidResponse);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this resize for outstream renders? My assumption here is that it could if the bid has video dimensions defined as the width/height and could cause white space, but perhaps I am overlooking something

Copy link
Collaborator Author

@dgirardi dgirardi Nov 14, 2023

Choose a reason for hiding this comment

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

video doesn't go through this, both pbjs.renderAd and PUC throw an error if they're asked to render a video bid - since they don't know the player to use or how to interact with it. The flow for it is very different and I think it wouldn't result in a GPT frame unless you set up the player in your creative.
Our guides for it do not use GPT at all and instead generate a VAST url that the pub is expected to submit to their player (or the new-ish video module can do it for them, but still without a separate creative iframe that could send messages here).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I misunderstood your question - if an outstream renderer is in use and the frame here is therefore useless, are we resizing it to be large and empty? I will do some testing and report back.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The answer is no, when bids have a renderer this code path is skipped - I added a test case for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yep I see. Thanks for confirming!

Copy link
Contributor

@mmoschovas mmoschovas left a comment

Choose a reason for hiding this comment

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

lgtm

@EskelCz
Copy link
Contributor

EskelCz commented Feb 19, 2024

@dgirardi Does this PR also solve the native template rendering through renderAd? We discussed it some time ago, here: #10006 (comment)

@dgirardi
Copy link
Collaborator Author

@EskelCz no, but #10819 does - and it would be great to get real world feedback on it!

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.

Consolidate Dual render ad paths
9 participants