Search code examples
amp-htmlprebid.jsprebid

Prebid with amp using DFP


I'm trying to use prebid with amp, but I'm getting the error:

f.js:8 Error: Unknown attribute for doubleclick: prebid.
at w (https://3p.ampproject.net/1496245713200/f.js:12:20)
at E (https://3p.ampproject.net/1496245713200/f.js:22:467)
at va (https://3p.ampproject.net/1496245713200/f.js:9:544)
at https://3p.ampproject.net/1496245713200/f.js:184:250

I reviewed the code and I'm using the example from http://prebid.org/dev-docs/show-prebid-ads-on-amp-pages.html#amp-content-page , but I can't find the error.

Here's my amp-ad code:

<amp-ad width="300" height="250" layout="responsive" type="doubleclick" json='{"prebid":{"requestBidsDuration":2500,"adUnits":[{"code":"/9999999/XXXXXXXXXXX","sizes":[[300,250]],"bids":[{"bidder":"rubicon","params":{"accountId": "99999", "siteId": "99999", "zoneId": "99999", "sizes": "[15,10]"}},{"bidder":"appnexus","params":{"placementId": "99999999"}}]}]}}' data-slot="/9999999/XXXXXXXXXXX"></amp-ad>

remote.html and creative is as the example from prebid.


Solution

  • I had the same issue and had to edit the code in the remote.html file.

    The problem is that the doubleclick tag does not allow to have any user-defined fields, but the prebid settings in the "json" field of your tag is one.

    This issue can be fixed it by modifying the setTargeting function to remove this field:

    function setTargeting(config, done) {
        config.targeting = getTargeting(config.slot);
        delete config.prebid;
        done(config);
    }