Publisher Ad Server – Common Integration Issues and Debugging

Debugging

While you are making your test pages, there are a number of indicators to tell if your code is working with Sortable's.

  1. Look at the webpage and see if an ad is filling the slot. 
    • If yes, this means the code is working, but not necessarily loading Sortable's ads. See step 2 for ways to see if Sortable's is working.
    • If no, double-check that you replaced all the correct GPT calls and that your GAM number and ad unit code are correct from the defineSlots. If the calls are correct, proceed to the next checks to see if you can see any issues.
  2. Using your browser inspector (we recommend using Chrome):
    1. In network: Search for "deployads". Make sure the JavaScript file name for your site has a status of 200. This means the JavaScript file called matches a file enabled in Sortable's system.
    2. In elements: Look for the data-google-query-id attribute on the ad div. This means that GAM received the request and responded (it does not necessarily mean that it filled).
    3. In elements: Look for the data-ad-imp attribute on the ad div. This means that Sortable received the request and responded (it does not necessarily mean that it filled).
    4. In network: Search for "gdfp". Select the first occurrence that has a URL that starts with "https://securepubads.g.doubleclick.net/gampad/ads?gdfp_req=". In the Query String Parameters look for "prev_scp". Look for Sortable's keys being set on the ad calls. srt_sdbg or sdbg should be set on all requests sent to Sortable.
    5. In Console: Run googletag.openConsole(); to open Google's debugger. This adds an overlay over each Google Ad Manager ad slot in your browser.
    6. Look at the Line Items that are winning the slots using the link in the overlay. If Sortable's line items are winning, the code is likely correct. You may need to look at several slots before finding one that Sortable won depending on the other line items set up in your GAM. Sortable's team can double-check your code to ensure every ad unit is running as expected.
    7. In the footer bar that appears, select the Page Request tab. Look for the list of issues or check that the code is correct.
      • If tagged correctly you should see "Page tagged Correctly!"
      • If tagged incorrectly, you should see Warnings or Errors.
      • Depending on the Warning or error, you may need to fix some code. See Common Issues (below) for some examples.

Common Issues

Warnings or errors in Google Console

In Google Console, run "googletag.openConsole();" to open Google's debugger.

  • If tagged incorrectly, you should see warnings or errors.
  • Depending on the warning or error, you may need to fix some code. 

Common Google warnings include:

Ad unit did not fetch

  • This sometimes occurs when using sizeMapping, when the device size is not associated with any ad sizes. If this is the cause, it is expected and does not need to be actioned. 
  • If the warning is not caused by sizeMapping, make sure there is a defineSlot, ad div, and display call for this slot, and that all three (3) are referring to the same ID and that the ID is not used for any other ads on page.
  • If you are using a testing domain, provide the URL to Sortable so we can whitelist the domain. If the site domain is not on the whitelist, the ad units may fail to fetch. We cannot whitelist IPs, so you need to forward to a testing domain.

Ignoring the PubAdsService.enableSingleRequest() call since the service is already enabled

  • All page-level settings must be called before enableServices. Any calls after the enableServices call are ignored. This also includes page-level key-value targeting, disableInitialLoad, enableSingleRequest, and collapseEmptyDivs.

googletag.defineSlot was called more times than there are DIVs in the DOM associated with ad slots, or googletag.defineSlot was called without a corresponding DIV on the page

  • There are ads being defined using defineSlots that do not have a corresponding div on page. All ad slots defined must have a matching div and display call.

Code issues

Sortable's JavaScript library doesn't start loading

  • Double-check that you are calling the correct JavaScript file name as given by Sortable. This usually matches your website's domain, however, sometimes it does not always match.
  • Ensure that there are two forward slashes at the beginning. For example, //tags-cdn.deployads.com/a/snapsort.com.js

Ads aren't loading correctly

There can be many issues that prevent ads from loading correctly. 

  • Ensure that all GPT calls were replaced with the Sortable versions mentioned in this document. This includes third-party scripts like Amazon.
  • Ensure that any calls that should be inside the Google Command Queue are wrapped with the appropriate scripts.  
    i.e. googletag.cmd.push(function() { });
  • Double-check your syntax to make sure it matches GPT examples. 
  • If using disableInitialLoad, call refresh for the ads to load on page load. This should be called after the ad's display call.

Defining the correct unit

  • When using defineSlot on page, you must use a / at the beginning before the GAM ID number and use the ad unit code with the same casing as it was defined in GAM. For example,  /123456789/ad_unit_code_from_GAM

Multiple GDFP calls are made to your GAM when using enableSingleRequest. 

There are a few possible causes for this.

  • The ad unit used is not set as a valid ad unit in Sortable's system. Check with Sortable to ensure this ad unit is valid.
  • All defined Sizes in the defineSlot are not supported header bidding sizes. Verify that the defineSlot sizes are the correct sizes. If there are no supported sizes, we will send this in a separate request to GAM.
  • There is greater than 100ms between display calls. This can be resolved by using disableInitialLoad and refreshing, or by moving the display calls together after the last ad div has been defined (or at the bottom of the body).

Reporting Issues

There is no reporting for my site in Sortable Analytics

  • Ensure that you are defining the correct ad unit as explained above. Not using the beginning / will cause your site to not report.

GAM is reporting ad units as “default” when there are no units named “default”

  • If you are using GAM 360 and using ad units that are not yet entered in your GAM, it can cause this issue. These are known as “Suggested ad units”. You can view the list of suggested ad units and if desired, add them to your GAM.

Defining ad slots that do not have a matching div on-page

  • This can cause reporting discrepancies in both Sortable and GAM.

For industry insights and information about our product offerings, check out our blog!

Want to see our products in action? For a demo, fill out a form here.