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

Core: update creative code and example #11350

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integrationExamples/gpt/x-domain/creative.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// creative will be rendered, e.g. GAM delivering a SafeFrame

// this code is autogenerated, also available in 'build/creative/creative.js'
<script>!function(){"use strict";var e=JSON.parse('{"FP":{"h0":"adRenderFailed","gV":"adRenderSucceeded"},"q_":{"XW":"exception"},"X3":{"Z":"Prebid Request","YC":"Prebid Response","Ks":"Prebid Event"}}');const n=e.X3.Z,t=e.X3.YC,r=e.X3.Ks,s=e.FP.h0,o=e.FP.gV,i=e.q_.XW,a=(()=>{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}})();var c;window.pbRender=(c=window,function({adId:e,pubUrl:d,clickUrl:l}){const g=new URL(d,window.location).origin;function u(n,t,r){const s=new MessageChannel;s.port1.onmessage=f(r),c.parent.postMessage(JSON.stringify(Object.assign({message:n,adId:e},t)),g,[s.port2])}function p(e){u(r,{event:s,info:{reason:e?.reason||i,message:e?.message}}),e?.stack&&console.error(e)}function f(e){return function(){try{return e.apply(this,arguments)}catch(e){p(e)}}}u(n,{options:{clickUrl:l}},(function(n){let s;try{s=JSON.parse(n.data)}catch(e){return}if(s.message===t&&s.adId===e){const e=a(c.document,{width:0,height:0,style:"display: none",srcdoc:`<script>${s.renderer}<\/script>`});e.onload=f((function(){const n=e.contentWindow;n.Promise.resolve(n.render(s,{sendMessage:u,mkFrame:a},c)).then((()=>u(r,{event:o})),p)})),c.document.body.appendChild(e)}}))})}();</script>
<script>!function(){"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}})();var t;window.pbRender=(t=window,function({adId:r,pubUrl:s,clickUrl:o}){const i=new URL(s,window.location).origin;function a(e,n,s){const o=new MessageChannel;o.port1.onmessage=d(s),t.parent.postMessage(JSON.stringify(Object.assign({message:e,adId:r},n)),i,[o.port2])}function c(n){a(e,{event:"adRenderFailed",info:{reason:n?.reason||"exception",message:n?.message}}),n?.stack&&console.error(n)}function d(e){return function(){try{return e.apply(this,arguments)}catch(e){c(e)}}}a("Prebid Request",{options:{clickUrl:o}},(function(s){let o;try{o=JSON.parse(s.data)}catch(e){return}if("Prebid Response"===o.message&&o.adId===r){const r=n(t.document,{width:0,height:0,style:"display: none",srcdoc:`<script>${o.renderer}<\/script>`});r.onload=d((function(){const s=r.contentWindow;s.Promise.resolve(s.render(o,{sendMessage:a,mkFrame:n},t)).then((()=>a(e,{event:"adRenderSucceeded"})),c)})),t.document.body.appendChild(r)}}))})}();</script>

<script>
pbRender({
Expand Down
2 changes: 1 addition & 1 deletion libraries/creative-renderer-native/renderer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.