Re: Companion Ads with player in iframe

441 views
Skip to first unread message

Shawn Busolits (IMA SDK Team)

unread,
May 31, 2013, 9:36:01 AM5/31/13
to ima...@googlegroups.com
Hi Tim,

Are you able to load the GPT script on the main page, or must that be loaded inside the iFrame as well? If you can load it on the main page, you can implement companions the same way as in the example, and include the proxy script shown under Host the HMTL5 SDK within an IFrame. The string you pass to the googletag.defineSlot() method will just be the id of the DOM for the companion. Unfortunately, we don't currently have a solution for the case where the GPT script is loaded in the IFrame and the companions are on the main page.

Thanks,
Shawn Busolits
IMA SDK Team

On Friday, May 31, 2013 7:36:16 AM UTC-4, Tim wrote:
Hey,
For reasons that I won't go into, theHTML5 video player on my site is in an iframe in the main page that is created programmatically.

I have got the video to display a pre-roll following the HTML SDK instructions. It seems to be working fine. Now I have been looking to implement companion ads too.

Unfortunately my companion ad slots are in the main body of the page not the iframe that the content video is playing in. Is there anyway I can initialise the companion slots in the parent document? The googletag.defineSlot() method only takes a string id, and not a dom element.

Any help would be appreciated,
Tim

Greg Kindel

unread,
Jan 14, 2014, 6:45:17 PM1/14/14
to ima...@googlegroups.com
Quick Q:  is it possible to do this with the Flash IMA SDK?    If it matter, the iFrame can be made same domain.  

Did a few web searches, but they all led back to this thread, so I figured I'd ask.  Have tried the proxy as well as manually pointing a dozen child window properties (google, googletags, etc) to the top without success.

Cheers,
Greg

Tim

unread,
Jan 15, 2014, 5:46:46 AM1/15/14
to ima...@googlegroups.com
Greg,
I use the Flash SDK and the HTML5 SDK on our site as we choose a player based on what the browser can support. Both support companion ads. I use the gpt_proxy.js in the top frame and register companions with GPT as described in https://developers.google.com/interactive-media-ads/docs/companions/companions-gpt

I didn't implement the flash part of our solution, but it's my understanding that as long as you use GPT and register the slots on the top page it "magically" works. Do you have any example code?

Tim

Greg Kindel

unread,
Jan 15, 2014, 10:26:48 AM1/15/14
to ima...@googlegroups.com
Nothing public yet.  Poking through the minified code, it looks like the html5 sdk uses post message, which I doubt the flash sdk does, though possibly it can be shimmed.  I sniffed the window properties in both parent and child frames and the namespace footprint is pretty huge (dozens of global variables), and on the child flash side the global names are dynamically generated.  This make a JS hacky solution both less plausible and more fragile.  

I'm guessing it's just not supported though, like you, we're hoping to swap the ad code in dynamically as the player itself switches between flash and HTML5.  Sounds like the same problem only we started on the flash side.  Would be nice if the two libraries were more unified in functionality.

Thanks for the message --it's good to know the html5 sdk works in the iframe. I'll keep this thread updated should I come across a solution on the flash side.

Greg

Shawn Busolits (IMA SDK Team)

unread,
Jan 15, 2014, 12:12:50 PM1/15/14
to ima...@googlegroups.com
Hey Greg,

Just to get some clarification - you want to load the gpt script in the iframe and have companions on the main page, correct?

Thanks,
Shawn Busolits
IMA SDK Team

Greg Kindel

unread,
Jan 15, 2014, 2:01:58 PM1/15/14
to ima...@googlegroups.com
Hi Shawn, 

I appreciate the response!  You are correct--the (flash) player is in an iframe and companions are in the parent, which I believe is a similar use case to the one described by Tim's original post.  Parent frame with GPT and proxy, child frame with Flash IMA player (in this case Strobe).  I've confirmed that the child page can render the companion ads if I do load GPT there, but I'm looking to have the companions in the parent page.   This is mostly an architecture decision so we can give our customers a player, not unlike the YouTube js+iframe embeds, but let them declare and use GPT companion slots as they see fit in the parent.

Any thoughts on whether this supported with the Flash IMA SDK?  The "Using Companion Ads with Google Publisher Tag" page you linked earlier does conspicuously mention only the HTML5 solution, but no explicit mention of it not being supported by the Flash sdk. 

Thanks,
Greg

Shawn Busolits (IMA SDK Team)

unread,
Jan 16, 2014, 11:09:13 AM1/16/14
to ima...@googlegroups.com
Hey Greg,

Unfortunately this use case isn't supported currently. I'll work with the rest of the team to see if it's something we can add.

Thanks,
Shawn Busolits
IMA SDK Team

Greg Kindel

unread,
Jan 16, 2014, 4:47:38 PM1/16/14
to ima...@googlegroups.com
Hi Shawn,

It's good to have it confirmed.  The more I look into the contract between IMA and GPT, the uglier such a feature looks. Especially when considering the free reign VPAID ads can have with the DOM and JS, there's really no way to proxy it.   I think the iframe solution is DOA and we'll have to take a different approach for site pages than we do for 3rd party page embeds.

Thanks for looking into it,
Greg

Dario Cargnino

unread,
Mar 21, 2014, 9:05:37 AM3/21/14
to ima...@googlegroups.com
Hi Shawn,
I must implement the same architecture, one flash video player inside an iframe with companion ad in the parent.

Are there news about this topic?
Will the proxy feature supported by the Flash IMA SDK?
Thanks

Dario

Bret McGowen

unread,
Mar 25, 2014, 10:33:44 AM3/25/14
to ima...@googlegroups.com
Hi Dario,

We still don't support this case (proxy so that Flash is within the iframe and GPT are companions outside). While we have it on our list, unfortunately I'm not sure that we will implement it any time soon. 


Bret McGowen
IMA SDK Team
Reply all
Reply to author
Forward
0 new messages