InLine unit

Integration for Rubicon Project

Once your list of domains is approved by Rubicon Project and you receive the InLine tag from your Account Manager, follow these integration instructions:

  1. If hardcoding on page, please copy/paste the tag at the bottom of your page. If using DFP or another ad server, please insert the tag into your ad server (see FAQs below).
  2. If hard-coding the tag, follow "widget_anchor" instructions below to place the tag at the bottom of the page and the anchor where you want the ad to appear(see FAQs below).
  3. Provide test page to Rubicon Project for approval
  4. Go live!
  5. Contact your Account Manager with any questions.

Important Links

  1. SMART Widget Anchor -- Our SMART anchor scans each webpage and determines where on the webpage the inLine will live.
  2. DFP Integration -- Guidelines on how to traffic the inLine unit using DFP

Custom parameters

InLine supports all regular widget parameters at, plus some specific to this unit (below):

Param Type Details
widget_anchor String CSS selector pointing to element on page after which widget will be inserted. Without it widget will be inserted right after SCRIPT tag of InLine unit. See FAQs below.
widget_position String Which position widget should be placed, according to anchor element. Possible values are: before, after, append, prepend. Default is after.
widget_label String To put a label on top the unit use this parameter. Usually publishers ask for an "Advertisement" label. No label by default.
negative_anchor String CSS selector pointing to element on page. Use this to prevent widget from appearing if a specific element is present on the page.
positive_anchor String CSS selector pointing to element on page. Use this to prevent widget from appearing if a specific element is not present on the page. This is not a widget_anchor, this selector won't be used as a render spot for unit. If both negative_anchor and positive_anchor parameters provided, unit will check both conditions, but negative_anchor has a priority.
nologo 1 or 0 When 1, removes Virool logo from widget. (default: 0)
responsive 1 or 0 Use this parameter to load unit in responsive mode. In this mode it will take over all available space of it's container. Unit will keep an original aspect ratio(16x9 by default). (default: 0)
mute_overlay 1 or 0 When value is 0 disable inline video unmute on mouse over and inserts a "mute/unmute" instead. Some publishers require this instead of default behaviour. (default: 1)
no_close_button 1 or 0 When value is 1 removes "Close" button from unit. (default: 0)
is_mobile 1 or 0 set to 1 to load unit with cover player. (default: 0)
force_ssl 1 or 0 set to 1 to force unit and rubicon tag to have HTTPS protocol. (default: 0)
vast_params String Use it to provide an additional parameters string which will be passed to rubicon tag. (e.g. param1=value1&param2=value2).
responsive true If true, inLine unit will adjust width & height based on browser size
percent_width 1 to 100 Resizes inLine based on (%) of container element. Example: if your %width is 50 (50%) and container width is 1000px, then player width will be 500px and height will be 500 * (height/width)
aligncenter true If true, inLine unit will align in the center of the container.
dfp_view String URL to track DFP view. Designed to use with DFP Macros. By default you need to set it to %%VIEW_URL_UNESC%%.
clickthrough_url String URL to track click-through events happening inside unit. Can be used with DFP macros %%CLICK_URL_UNESC%%.

Example tag

// Element on your page where the widget will be placed right after.

// This script should be hardcoded on page or copied & pasted to DFP. Please note: the widget_anchor value, my-div, is just an example - please make sure this value is replaced below with the proper CSS element.

<script type="text/javascript" id="vrl_script0">
  window.viroolParams = {
    widget_anchor: 'SMART/top',
    width: 560,
    dfp_view: '%%VIEW_URL_UNESC%%',
    height: 400,
    key: '09sjxem1o1br',
    smart_highlight: false,
    responsive: true,
    is_mobile: true,
    aligncenter: false,
    ap: true
(function(d, t) {
  var s, scripts;
  if (document.currentScript) {
      s = document.currentScript;
    } else if (document.readyState === 'loading') {
      scripts = document.getElementsByTagName('script');
      s = scripts[scripts.length - 1];
    } else {
      s = document.getElementById('vrl_script0');
  var g = d.createElement(t);
  g.async = true;
  g.src = '//';
  s.parentNode.insertBefore(g, s);
})(document, 'script');

Using with DFP macros

Some sites may want to track our tag insertions with DFP macros. To do so, add dfp_view:%%VIEW_URL_UNESC%%, to script tag SRC parameters (see example above). This will add a corresponding pixel to the page on widget load.

"No-Ad" Callback

This snippet must be hardcoded on the page where the widget is present.

    window.onViroolInlineNoAds = function (wid) {
      console.log("no ads in unit: " + wid);
      // Please add logic here to call another demand partner

In this example, unit will execute callback function onViroolInlineNoAds if Virool network has nothing to offer to current site visitor. This no-ad callback will not work if you copy and paste it into DFP.


How can I serve the InLine via an ad server (e.g. DFP)?

Create a new ad unit in DFP (Google Publisher Tag) called "Out-of-page unit" to serve non-standard ads. Copy/paste the InLine player tag into your ad server, trafficking the player tag as a creative. Create a JavaScript tag (not iFrame tag) for the placement you trafficked the InLine creative to, and place your ad server's tag onto the page where you want the ad to appear.

Check tutorial: here

How should I implement the widget_anchor?

The widget anchor allows publishers to denote where they would like the InLine widget to appear. The value of the widget anchor should be URL-encoded. Please note: if you are using DFP, please make sure the CSS element (i.e. div id="some-section") is outside of the DFP tag, as our widget will not be able to find it within the DFP iFrame.

The widget anchor is the first thing unit checks on page. If unit won't find anything by anchor string it won't proceed with further loading. e.g. if widget_anchor value is #testdiv > p:nth(2) make sure that page has element with ID attr set to testdiv and it has at least three P tags inside it.

Some examples:

// InLine unit rendering after div ID "virool" - please note, "#" must be URL-encoded
// widget_anchor=%23virool

<div id="virool"></div>
// InLine unit rendering after div class "virool"
// widget_anchor=.virool

<div class="virool"></div>
// InLine unit rendering after 2nd paragraph element in div id "virool"
// widget_anchor=%23virool%20p%3Anth(1)
// unencoded value: #virool p:nth(1)

<div id="virool">
    <p>Paragraph 1</p>
    <p>Paragraph 2</p>
    <p>Paragraph 3</p>

Can I place the unit in an iFrame?

No, the unit should be placed directly on the host page if hardcoding on page. Placing the unit within an iFrame is not possible as it changes its behavior and dynamic functionality.

Where is the best spot to place the tag?

If placed in-text (e.g. in-article), our recommendation is to place the unit after the second paragraph. Since an impression is counted when the area comes into view, we do not recommend placing the unit far below the fold.

What happens if there are no campaigns available for the viewer?

If an ad call is made and no campaign is returned, the tag lives invisibly on the page, and the widget will not expand within the text. The page content is unaffected, and the user is none the wiser.

What is the size of the unit?

InLine is customizable in size by modifying the width/height parameters in the tag (recommended size is 640x400 or 640x360). The unit must occupy the full width of the text/content section on your site, and must be larger than 450 pixels in width for the placement to be approved.

Can the unit be closed once it loads on a page?

Yes, the close button loads immediately at the top right.