Ad Tags and Testing

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 add 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 : window.top, d_yahoo = w_yahoo.document;
  w_yahoo.adUnitCode = w_yahoo.adUnitCode || [];
  w_yahoo.adUnitCode.push("9f6d1adc-55a8-4b13-9c8d-d91fb465d984");
  w_yahoo.apiKey = "JSFP58RN469KXFC28PJR";

  (function () {
    var script = d_yahoo.createElement("script");
    script.async = true;
    script.src = "https://s.yimg.com/av/yap/ga/yap.js";
    d_yahoo.body.appendChild(script);
  })();
script>

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 : window.top, d_yahoo = w_yahoo.document;
    w_yahoo.adUnitCode = w_yahoo.adUnitCode || [];
    w_yahoo.adUnitCode.push("9f6d1adc-55a8-4b13-9c8d-d91fb465d984");
    w_yahoo.adUnitCode.push("816d1adc-55a8-4b13-9c8d-d91fb465d767");
    w_yahoo.adUnitCode.push("0106d1adc-55a8-4b13-9c8d-d91fb465dh9");
    w_yahoo.apiKey = "JSFP58RN469KXFC28PJR";

    (function(){
      var script = d_yahoo.createElement("script");
      script.async = true;
      script.src = "https://s.yimg.com/av/yap/ga/yap.js";
      d_yahoo.body.appendChild(script);
    })();
  script>

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 || [];
  adUnitCode.push("9189eb82-100d-4d26-b869-cee9e12e3b86");
  var apiKey = "D6DWPT4FHRQTJN3Q8Z6K";

  (function () {
    var script = document.createElement("script");
    script.async = true;
    script.src = "https://s.yimg.com/av/yap/ga/yap.js";
    document.body.appendChild(script);
  })();

  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);
script>

Passback

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 getAds.do?locale=...

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 Flurry.com Ad Tags: App Publishing > Websites & Ad Units > Edit Pencil [note: replace the url displayed with any new url and click save to add new urls - this does not delete the existing url]
  • 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:

https://ir2.beap.gemini.yahoo.com/mbcsc?bv=1.0.0&es=Pdn6F4UGIS_VixbksF7o89qGJocQWNAly7kLpoUOKOt6Hn0pn4cVP_.pV_06kz4AJX3JTVizDMjtkVLwRTf4qAmpds40VFblqLSEkPO86ysgz01iuM4nT24mXMrDNlzdfM2GyV6ZpDw9IsmTRPMGna0qCDGueXijW3f6oOkcPZasFtYH6O_g4YcBfCWdLJwlcW9LSmP69UMuFq9r4MGv0OQ92zJZEpT067YnjtfbnQjvIyOTyfF4.fANch7y6pEF_aAH2tP.E7KxXvrlCnzJEx3bpANa1jQ5a0ob0zB5.WiJD3mueZqyrPh6Knf0FOnsRMCukqpcl3PSdesVGekLOjYe93LqSqz0by6uhnrES74vKhdrR31yq_Q22dvfywQZ9JTJegmVJ1NbQCB8AiA-&ap=pp%3Dm%2Cpi%3D98

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}