# Debug ads implementations

If an ad that is configured in a Tenant is not showing, it is possible to debug it in order to find the source of the problem.

# Detect the missing ad

To begin, it is necessary to identify the ad server, ad slot, size and any other relevant information of the ad that is not appearing.

You can use the marfeelads=2 query parameter to see the configuration of ads on a Tenant's page and where they are located.

For example, to see it on the Home page, use a link like this in mobile: www.examplesite.com?marfeelads=2.

It also works in the local environment (e.g. http://localhost.marfeelcache.com/hub/origin/www.examlesite.com/index?marfeeldev=true&marfeelgarda=off&marfeelads=2)

A green rectangle will appear in the position of every ad and will show the content as established in the getDebugInfo method from the AdServer class of the ad server implementation.

For example, this is how a Taboola ad would look like with this feature:

advertisement-how-to-debug-ads-taboola

# Confirm the ad call

To see if the requested ad is found and returned by the server, follow these steps:

  1. Open the Marfeel version of the Tenant with Chrome DevTools and click on the Network tab.

  2. Filter the Network activity by the ad slot or any other relevant detail. For instance, if the ad slot that you are debugging is /12345678/examplesite.com/portada_top, you can filter by just portada_top.

  3. Check the Headers tab from the result on Network. Reload the page if necessary. If the ad call is correct, you should see the 200 status code:

advertisement-how-to-debug-ads-ad-call

WARNING

When filtering, make sure that the marfeelads=2 query parameter is not added in the URL. If the ad does not load, it won't be shown in the Network activity.

# Check if the ad is loading

On the Elements tab of Chrome DevTools, search for the tag (e.g. iframe or a div) that contains the information of the actual ad.

As a reference, every ad of a Tenant is loaded in a div with the mrf-adv and mad classes.

Some ad slots can also be a pattern of an id, as follows:

<div id="google_ads_iframe_/12345678/examplesite.com/portada_top__container__">

# DFP tags

If it is a DFP tag, you can introduce the Network ID, Ad Unit Code, Ad Slot Sizes and Custom Targeting (if any) in the Ad Manager Tag Generator & Tester (opens new window) to preview it.

You can also use the tag generated by this tool to test it in an empty HTML file.

# Use a test HTML file

Alternatively, you can add the script in an empty HTML file and see if it loads.

There is a testHTML directory (opens new window) on MarfeelXP for certain adServers that you can use.

For example, you can use this HTML template for a DFP ad tag:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <meta charset="UTF-8">
    <title>DFP</title>
</head>
<body>
<script async="async" src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script>
    var googletag = googletag || {};
    googletag.cmd = googletag.cmd || [];
</script>
<div id="adContainer">
    <script>
        googletag.cmd.push(function() {
        googletag.defineSlot('/12345/marfeel/wii', [[300, 50], [320, 50]],'adContainer')
            .addService(googletag.pubads())
            .setTargeting("videogame", "Mario Kart")
            .setTargeting("character", "Peach")
        googletag.enableServices();
        googletag.display('adContainer');
        });
    </script>
</div>
</body>
</html>

# Debug the ad server

  1. Load the Tenant in your local environment and open the Chrome DevTools on the Marfeel site.
  2. Go to the Sources tab and look for the file of the ad server that you want to debug. For example, if you want to debug a Taboola, you should find the Taboola ad server JS file.
  3. Add the breakpoints as needed.

advertisement-how-to-debug-ads-taboola-debug.png

# Simulate browsing from other countries

Tenants can have ads that only load in certain countries. In this case, you can use a proxy to simulate browsing from different geographical locations. See this article to learn how.