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

[Native] Special characters on body / image / title from prebid.js to DFP

Open haroldpussat opened this issue 8 years ago • 5 comments

Type of issue

Question

Description

We are testing native implementation from Prebid.js (1.16-pre). For this I create a simple test page with a native slot (size 1&1) and a simple mediaType declared as native. There is only appnexus in competition for the native slot. I also create a native format and style on our DFP account. What I see on my console is I get answer from Appnexus with "special characters" such as "€", "!", "*" and so on For example :

hb_native_body_appne value: Votre hôtel 5* à Rennes à partir de 167 €

DFP troubleshooting tool show me the same native body value image

But I'm not able to display the body content from a simple native format / style (based on http://prebid.org/adops/setting-up-prebid-native-in-dfp.html). I put some console trace on my native style and it says body / image are empty ` console.log("HPU Version Nativ 1.0e");

console.log('HPU LinkURL :' + '%%CLICK_URL_UNESC%%%%PATTERN:hb_native_linkurl%%');

console.log('HPU Brand :' + '%%PATTERN:hb_native_brand%%');

console.log('HPU Title :' + '%%PATTERN:hb_native_title%%');

console.log('HPU Body :' + '%%PATTERN:hb_native_body%%');

console.log('HPU Image :' + '%%PATTERN:hb_native_image%%');`

image

As a result, the native ad is not displayed correctly image

So I updated the targeting.js from prebid in order to add a fixed encodeURIComponent on the value targeted value to DFP (see function : setTargetingForGPT)

image

On the native style, I also add decodedURIComponent for body, brand, title and image. With those changes, image

I'm able to display the native ad on the test page image

Steps to reproduce

1 - Prebid.js 1.* 2 - A native ad with body / image / title including with special characters such as "€", "!" or "*"

I don't know if I missed something on the implementation (on prebid or dfp setup) or if I'm mistaken or if it's a lack of knowledge or if it's a documentation issue

Test page

With prebid.js 1.16-pre : http://www.precom-multimedia.com/interne/hpu/test_nativ2/?dfptest=50 With encodeURIComponent on Prebid and a decodeURIComponent on DFP Native Style : http://www.precom-multimedia.com/interne/hpu/test_nativ2/index_custom.html?dfptest=40

Both pages are on Prebid debug mode

Expected results

Actual results

Without encode on prebid and decode from native style, I have blank hb_native_body / image

Platform details

PRebid 1.16-pre, Prebid 1.15 Chrome / Firefox (last versions)

Other information

haroldpussat avatar Jul 16 '18 14:07 haroldpussat

Thanks for the bug report. Would you mind opening a PR to resolve?

mkendall07 avatar Jul 23 '18 16:07 mkendall07

Thanks for the feedback, I never opened a pull request. I'll try to do it.

haroldpussat avatar Jul 24 '18 07:07 haroldpussat

FYI, we built our own Prebid.js including encodeURIComponent on native key (impact on utils.js and targeting.js). So that we can decode them on DFP Native style and use a document.write to render the native ad. We also update DFP lineItems so that we can receive SendallBids-> false. Our custom Prebid.js is live on one of our production site with one native position : https://rennes.maville.com/ . We are monitoring the prebid / DFP on this site.

haroldpussat avatar Sep 11 '18 15:09 haroldpussat

@haroldpussat , have you opened a pull request for this change?

wqi1972 avatar Oct 22 '18 16:10 wqi1972

https://github.com/prebid/Prebid.js/pull/3224 is an attempt to fix this.

nanek avatar Oct 24 '18 18:10 nanek