Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Targeting companion ads (top,parent)

2 replies [Last post]
Reply

Hello,

I am trying to target companion ads outside the iframe, targeting specifically "top" window.

I have tried this

"ads": {
"target":"_top",
"companions": [
{
"id":"headerBanner",
"width":"728",
"height":"90",
"target":"_top",
"index": 0
}
],

Also I have tried puting top.headerBanner in id that didn't work. Any suggestions.

Thanks!

Reply

Hi Alex,

Hmmm.. that's going to be tricky.... companions only get inserted into DIVs in the same page as the player, but you could modify the companion JQuery code and do something funky in there to insert it elsewhere.

Basically to do that:

1) Instead of using the native OVA SWF insertion of the companion code, switch on the "processCompanionsExternally": true, option to tell OVA to use the external JQuery based library to insert the companion code

2) Grab the library from the OVA developer repository here:

http://developer.longtailvideo.com/ova/browser/trunk/ova.as3/js/ova-companions-jquery.js

3) Modify the library to do the insertion the way you need

See here for some details:

http://www.longtailvideo.com/support/open-video-ads/13059/configuring-ova-to-deliver-companion-ads

And you can see some examples running here:

http://static.openvideoads.org/qa/latest/ova.jwplayer.5x/examples/pages/companions/index.html
http://static.openvideoads.org/qa/latest/ova.flowplayer/examples/companions/index.html

Look at those examples that are titled "Advanced Companion Display" - they are the ones that use the external "ova-companions-jquery.js" JQuery based lib...

Paul

Reply

That seems to work. But I am not sure how to target to the top window.. here is the code inside the js.

jQuery.fn.writeCompanion = function(src) {
  // Store jQuery(this) in a variable otherwise it will be out of scope in document.write
  var companionElem = jQuery(this);
  var tmpDocWrite = document.write;
  var tmpDocWriteln = document.writeln;
  document.write = function(arg){ jQuery(companionElem).append(arg); };
  document.writeln = function(arg){ jQuery(companionElem).append(arg) + 'n'; };
 
  //alert(src);
  //top.document.getElementById("headerBanner").innerHTML = src; // write out to top frame
   Function to retrieve a new advert from the server.
   jQuery(companionElem).html(jQuery(src));
};

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • You may post code using <code>...</code> .
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options