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> section.

This ad tag will work when placed 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=”native-ad-{adUnitCode}”></div>

Example Flurry Ad Tag

<script type="text/javascript">
window.native = window.native || [];
window.apiKey = "P55VS9SY2WQXH7TTF5ZW";

(function(d) {
  var script = d.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 ideally 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 2 ad units on the same page, using only one ad tag:

<script type="text/javascript">
window.native = window.native || [];
window.apiKey = "P11VS9SY2WQXH7TTF5ZY";

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

Self-injecting ad tags for non-stream placements

These ad tags automatically insert the required <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:

  • window.native.push(“833b5519-edb7-47c0-88be-1152bcae7870”);
  • container.className = “native-ad-833b5519-edb7-47c0-88be-1152bcae7870”;

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

<script type="text/javascript" id="native-1">
var scriptId = document.getElementById("native-1");
var scriptIdParent = scriptId.parentNode;
var container = document.createElement("div");
container.className = "native-ad-833b5519-edb7-47c0-88be-1152bcae7870";
scriptIdParent.insertBefore(container, scriptId);

window.native = window.native || [];
window.apiKey = "P11VS9SY2WQXH7TTF5ZY";

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

For Google Ad Manager (DFP) implementations use the following tag format:

<script type="text/javascript">
 var win =;
 var doc = win.document;
 var frameElementId =;
 var frameElement = doc.getElementById(frameElementId);
 var frameElementParent = frameElement.parentNode;
 var container = doc.createElement("div");
 container.className = "native-ad-833b5519-edb7-47c0-88be-1152bcae7870";
 frameElementParent.insertBefore(container, frameElement);

 win.apiKey = "P11VS9SY2WQXH7TTF5ZY";
 win.native = win.native || [];

 var script = doc.createElement("script");
 script.async = true;
 script.src = "";
 doc.body.appendChild(script); = "none";


You have the option to use section-based passback methods vs. globals. If you change the default script to use an object instead of a string, you can assign callbacks and other items directly to the section.

Section-based passback method




 code: "833b5519-edb7-47c0-88be-1152bcae7870",
 passbackHandler: function(section){
   console.log(section.code, section.message);
   // do something if this adunit returned 0 ads

Global passback method

A basic client-side passback can be run using the nativePassbackHandler global method. The nativePassbackHandler 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:

window.nativePassbackHandler = function(section){
 if (section.code === "833b5519-edb7-47c0-88be-1152bcae7870") {
   // do something if this section code returned 0 ads

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.

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} macro for every a href attribute.

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> elements’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}
  • Ad Label {sponsorLabel} or your own ad label.