Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

Native designs: Replacing placeholders for "missing" assets

Open anitaschiller opened this issue 3 years ago • 0 comments

Type of issue

Question

Description

While testing the new native creative implementation (https://docs.prebid.org/prebid/native-implementation.html), we realized that a prebid native ##macro## only gets replaced if a corresponding asset is sent.

If the bidder e.g. doesn't send a value for body which would replace the ##hb_native_body## placeholder, the string ##hb_native_body## will be inserted in the HTML template.

I suppose that when the native template calls renderNativeAd(pbNativeTagData) (with pbNativeTagData.requestAllAssets set to true), the function below is responsible to answer that request?

https://github.com/prebid/Prebid.js/blob/f0596c4366fc3cb5b12b28ea44af8b54c9b6bbc9/src/native.js#L228-L255

That would mean that a key-value pair for body only gets pushed in the message.assets array if body is part of adObject.native. If it's not, the placeholder won't be replaced.

Question

So what exactly is the purpose of setting requestAllAssets to true? 😊 I'm sure there were a lot of thoughts behind this!

Wished behavior

We were hoping being able to use the :empty selector in our native design's CSS in order to set a HTML element to display: none in case the bidder didn't send a value that can be inserted instead of the placeholder. That - however - only works if the placeholder was replaced by an empty string.

Thank you for your help!!

anitaschiller avatar Aug 02 '22 14:08 anitaschiller