Ad Tags and Testing

Finding the Ad Tag

Once your ad unit has been saved, the ad tag can be obtained from the ‘View Ad Tag’ link, next to the ad unit name on the edit ad unit page. (Monetization > Websites & Ad Units > Website name > Ad Unit name > View Ad Tag )

Hardcoding the Tags on a Page

The Ad Tag from the Flurry portal can be placed directly into the page code within the <body>...</body> tags; it should not be placed the <head> element.

This ad tag will work when placed in an iframe (including DFP) or hardcoded directly on the page. It will not work for SafeFrames or when sandboxed; please contact your Account Manager for assistance if you require SafeFrame integration.

Remember for “Replace” tags which use <div> tags to set the ad position, the <div> tag also needs to be hardcoded on the page:

<div class=”yap-ad-{adUnitCode}”></div>

Example Flurry Ad Tag

<script type="text/javascript">
  var w_yahoo = (top == self) ? window :, d_yahoo = w_yahoo.document;
  w_yahoo.adUnitCode = w_yahoo.adUnitCode || [];
  w_yahoo.apiKey = "JSFP58RN469KXFC28PJR";

  (function () {
    var script = d_yahoo.createElement("script");
    script.async = true;
    script.src = "";

Requesting multiple ad units on the same page

To request more than one ad unit per page, you should combine the ad tags into one. To do this you take the value of adUnitCode.push(“...”) from each ad unit and combine them into one JavaScript Ad Tag.

For example this ad tag is requesting 3 ad units on the same page, using one ad tag:

<script type="text/javascript">
    var w_yahoo = (top == self) ? window :, d_yahoo = w_yahoo.document;
    w_yahoo.adUnitCode = w_yahoo.adUnitCode || [];
    w_yahoo.apiKey = "JSFP58RN469KXFC28PJR";

      var script = d_yahoo.createElement("script");
      script.async = true;
      script.src = "";

Self-injecting ad tags for non-stream placements

These ad tags automatically insert the <div> tag for “Replace” ad units. These should only be used when you can guarantee the ad tag will be placed exactly where the ad should appear.

Important: The adUnitCode values in these two lines must be updated with the values for your ad unit and must match:

  • adUnitCode.push(“9189eb82-100d-4d26-b869-cee9e12e3b86”);
  • container_yap_div.className = ‘yap-ad-9189eb82-100d-4d26-b869-cee9e12e3b86’;

These tags will insert the ad immediately above where the ad tag is placed on the page.

<script type="text/javascript" id="yap_id1">
  var adUnitCode = adUnitCode || [];
  var apiKey = "D6DWPT4FHRQTJN3Q8Z6K";

  (function () {
    var script = document.createElement("script");
    script.async = true;
    script.src = "";

  var yap_script = document.getElementById('yap_id1');
  var yap_parent_node = yap_script.parentNode;
  var container_yap_div = document.createElement('div');
  container_yap_div.className = 'yap-ad-9189eb82-100d-4d26-b869-cee9e12e3b86';
  yap_parent_node.insertBefore(container_yap_div, yap_script);


A basic client-side passback can be run using the yapPassbackHandler. The yapPassbackHandler is a basic function which runs when the total number of ads returned is zero. By adding the following lines to the ad tag you can enable a basic client-side passback:

w_yahoo.yapPassbackHandler = function(){
  // add passback here

When ads are returned, the yapPassbackHandler will not execute. No server-side passback functionality is available.

Testing Prior to Launch

Before launching any ad unit, it is important to check that the ad unit is functioning as expected.

How to Test the Ad Unit

Ideally you should place the ad unit on a test page or in staging environment to fully test the ad tag, especially if integrating via DFP, an iframe or an ad server.

Alternatively, you can quickly check position and layout of the ad unit by pasting the JavaScript from the ad tag directly into the console of your developer tools. However note this will not work with DFP or iframe ad tags, and will not be able to verify the ad tag’s functioning in an ad server using this method.

You should repeat this test in multiple browsers.

How to Identify the Ad Call

  1. Open the Developer console in your browser
  2. Select the Network tab
  3. Search for getAds and Identify the item with a name starting

If you cannot locate the ad call you should:

  • Firstly check that the ad tag has been implemented on the test page
  • Check that the staging URL has been added to the Publisher record
  • For Ad Tags: App Publishing > Websites & Ad Units > Edit Pencil
  • Check for that there are no special characters (for example “curly” quotation marks) or spaces in the ad tag which might break the ad tag’s JavaScript and stop it executing the ad call.

If you have checked these and cannot identify the reason for the ad request not executing please reach out to your Partner Manager, with the link to the test page, for assistance.

Items to Check

Once you have the ad tag loaded on the page, you should check for the following:

1: Check that the ad loaded and is in the correct position

If no ad is rendered check the following:

  • you are using the correct ad unit for the page/position
  • Verify the XPath in use is valid

2: Check the Viewability Beacon has fired

In developer tools, in the network tab, search for for mbcsc

An example full beacon url is:

If this is present then it means the viewability beacon is firing and will record the impression

3: Click on the ad to check it takes you to the advertiser site

If you are taken to another page, check that you are using the {click_url} element for all <a> href attributes

If you are not able to click on the ad, check that you have firstly included at least one <a> tag with href="{click_url}". Depending on how you have constructed your ad tag’s template, you may also need to set the display property to display: block in the <a> link’s style attribute.

4: Check all required features are present

The ad should contain at minimum the following ad elements:

  • Ad Image {image}
  • Ad Title {title}
  • Gemini Logo {gemini} or {gemini_alt}
  • Sponsor Name {sponsor}
  • Click urls {click_url}