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

Dynamic creatives not working #11955

Closed
rmertens opened this issue Jul 10, 2024 · 1 comment · Fixed by #11956
Closed

Dynamic creatives not working #11955

rmertens opened this issue Jul 10, 2024 · 1 comment · Fixed by #11956
Assignees

Comments

@rmertens
Copy link

rmertens commented Jul 10, 2024

Type of issue

Bug

Description

We want to use Dynamic Creatives on CrazyGames for improved ad performance.

However, it results in the following errors:

Uncaught DOMException: Failed to read a named property '__pb_locator__' from 'Window': Blocked a frame with origin "https://044b13f7e96c39d14f4218eb1448fb73.safeframe.googlesyndication.com" from accessing a cross-origin frame.
    at t (https://044b13f7e96c39d14f4218eb1448fb73.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html:2:342)
    at https://044b13f7e96c39d14f4218eb1448fb73.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html:2:441
    at https://044b13f7e96c39d14f4218eb1448fb73.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html:2:1342
    at https://044b13f7e96c39d14f4218eb1448fb73.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html:2:1352
t @ container.html:2
(anonymous) @ container.html:2
(anonymous) @ container.html:2
(anonymous) @ container.html:2
container.html:2 Uncaught ReferenceError: pbRender is not defined
    at container.html:2:5

Steps to reproduce

  1. Set up a Sponsorship line item with as the creative in GAM:
<script>(()=>{"use strict";const e="Prebid Event",n=(()=>{const e={frameBorder:0,scrolling:"no",marginHeight:0,marginWidth:0,topMargin:0,leftMargin:0,allowTransparency:"true"};return(n,t)=>{const r=n.createElement("iframe");return Object.entries(Object.assign({},t,e)).forEach((([e,n])=>r.setAttribute(e,n))),r}})();function t(e){return!!e.frames.__pb_locator__}window.pbRender=function(r){let o=r.parent;for(;o!==r.top&&!t(o);)o=o.parent;return t(o)||(o=r.parent),function({adId:t,pubUrl:s,clickUrl:i}){const a=new URL(s,window.location).origin;function c(e,n,r){const s=new MessageChannel;s.port1.onmessage=l(r),o.postMessage(JSON.stringify(Object.assign({message:e,adId:t},n)),a,[s.port2])}function d(n){c(e,{event:"adRenderFailed",info:{reason:n?.reason||"exception",message:n?.message}}),n?.stack&&console.error(n)}function l(e){return function(){try{return e.apply(this,arguments)}catch(e){d(e)}}}c("Prebid Request",{options:{clickUrl:i}},(function(o){let s;try{s=JSON.parse(o.data)}catch(e){return}if("Prebid Response"===s.message&&s.adId===t){const t=n(r.document,{width:0,height:0,style:"display: none",srcdoc:`<script>${s.renderer}<\/script>`});t.onload=l((function(){const o=t.contentWindow;o.Promise.resolve(o.render(s,{sendMessage:c,mkFrame:n},r)).then((()=>c(e,{event:"adRenderSucceeded"})),d)})),r.document.body.appendChild(t)}}))}}(window)})();</script>

<script>
    pbRender({
        adId: '%%PATTERN:hb_adid%%',
        pubUrl: '%%PATTERN:url%%',
        clickUrl: '%%CLICK_URL_UNESC%%'
    });
</script>
  1. Either wait for a bid, or force a bid using the debugging setting, e.g. by using:
pbjs.setConfig({
    debugging: {
        enabled: true,
        intercept: [
            {
                when: {
                    adUnitCode: 'div-gpt-ad-1481021067162-0',
                    bidder: 'rubicon',
                },
                then: {
                    cpm: 10,
                    mediaType: "banner",
                    adId: '1111111',
                    bidder: 'rubicon',
                          ad: '<html><body><img src="https://files.prebid.org/creatives/prebid300x250.png"></body></html>',
                }
            }]}});
  1. Get error

Test page

/

Expected results

It renders the ad.

Actual results

Blank ad and errors:

Uncaught DOMException: Failed to read a named property '__pb_locator__' from 'Window': Blocked a frame with origin "https://044b13f7e96c39d14f4218eb1448fb73.safeframe.googlesyndication.com" from accessing a cross-origin frame.
    at t (https://044b13f7e96c39d14f4218eb1448fb73.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html:2:342)
    at https://044b13f7e96c39d14f4218eb1448fb73.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html:2:441
    at https://044b13f7e96c39d14f4218eb1448fb73.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html:2:1342
    at https://044b13f7e96c39d14f4218eb1448fb73.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html:2:1352
t @ container.html:2
(anonymous) @ container.html:2
(anonymous) @ container.html:2
(anonymous) @ container.html:2
container.html:2 Uncaught ReferenceError: pbRender is not defined
    at container.html:2:5

Platform details

Prebid 8.48.0, Chrome 126.0. on MacOS 14.5

@dgirardi dgirardi self-assigned this Jul 10, 2024
@dgirardi
Copy link
Collaborator

This is a regression introduced by #11863. The previous version should work - the update is relevant only to some formats (interstitial, anchor).

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

Successfully merging a pull request may close this issue.

2 participants