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

AdUnit defined native template #10006

Closed
EskelCz opened this issue May 26, 2023 · 7 comments
Closed

AdUnit defined native template #10006

EskelCz opened this issue May 26, 2023 · 7 comments

Comments

@EskelCz
Copy link
Contributor

EskelCz commented May 26, 2023

Type of issue

Question

Description

I'm trying to set up native ads, using adUnit defined templates, without a custom renderer
https://docs.prebid.org/prebid/native-implementation.html#42-implementing-an-adunit-defined-template
Using literally this example from the documentation:
https://docs.prebid.org/prebid/native-implementation.html#421-prebidjs-adunit-setup

I'm getting bids from magnite, which have all the native data in native key, on the bid response.
The issue is, it doesn't have an ad key, which means when I render it with pbjs.renderAd, this means that it fails with Error trying to write ad., here:

const message = `Error trying to write ad. No ad for bid response id: ${id}`;

I don't see where the native template rendering should kick in for this scenario. My template is there (in the mediaTypes.native), native data on the bidResponse is there, but renderAd doesn't seem to be made for that purpose. What am I missing?

Thanks

Expected results

Native ad being rendered

Actual results

MESSAGE: Calling renderAd with adId :7e523379a1127f
ERROR: Error trying to write ad. No ad for bid response id: 7e523379a1127f

Platform details

Mac OS, Chrome

Other information

Prebid 7.39.0

@dgirardi
Copy link
Collaborator

Native rendering currently works only with prebid universal creative - not renderAd. I think the docs say so but maybe not explicitly enough. We have several open issues about improving rendering - with this one I'd like to get rid of most of the inconsistencies between renderAd and PUC, including native rendering, but currently your options are to use PUC or reimplement it in your bidsBackHandler.

@EskelCz
Copy link
Contributor Author

EskelCz commented May 29, 2023

@dgirardi I see, thanks for the clarification. We'd rather not use the PUC, so I'll watch the proposal. Any idea on the timeframe? I'm wondering whether to do the bidsBackHandler, figure out how to trigger the event of the ad being rendered (to trigger analytics adapters etc) and rework it once it becomes a feature... or just wait for it for a few weeks. :)

@dgirardi
Copy link
Collaborator

@EskelCz I can't make any promises, but my best guess is in the order of a few months.

@EskelCz
Copy link
Contributor Author

EskelCz commented May 31, 2023

@dgirardi That's ok, thanks a lot. One question about the workaround though. Is there a way to trigger the emitAdRenderSucceeded from outside of Prebid? I'm going to do the custom rendering in the bidsBackHandler, but I need to trigger all the correct responses from bid adapters, analytics modules etc.

@dgirardi
Copy link
Collaborator

@EskelCz in your situation I'd probably use the same API that PUC uses, which is based on postMessage. If you craft messages in a particular way you can trigger adRenderSucceded / failed / bidWon and so on. I'm afraid you'll have to do some reading of the codebase though; there's no documentation outside of it since it's not public (but it's likely to remain stable because of how difficult it is for us to push PUC updates).

@EskelCz
Copy link
Contributor Author

EskelCz commented Jun 21, 2023

@dgirardi One more question if you don't mind, so I don't have to open a new issue for a similar thing:

For the direct/custom native rendering I used this postMessage, which works well:
{ message: 'Prebid Native', adId: winningBid.adId }

I ran into another use case for a custom rendering (rendering without an iframe), this time of a regular banner and I can't figure out how to trigger the same adRenderSucceded event in prebid.
I tried these messages:

{ message: 'Prebid Native', adId: winningBid.adId } // fails because regular banner doesn't have .native
{ message: 'Prebid Banner', adId: winningBid.adId } // nothing, doesn't trigger analytics
{ adId: winningBid.adId } // the same thing, doesn't work
{ message: 'Prebid Event', adId: winningBid.adId, event: 'adRenderSucceeded' } // nope

Is there some other message that would work?
Thanks a lot.

@dgirardi
Copy link
Collaborator

dgirardi commented Jun 21, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants