Google AdSense integration

From ClickTale Wiki
Jump to: navigation, search
ClickTale Wiki
The instructions on this page are intended for self service accounts.
Enterprise customers should contact their account managers for integration support.

When using ClickTaleUploadPage API method and AdSense, your ad blocks will be shown twice during playback. This is because in "client-capture" mode, the ads are rendered twice, once during recording and once during playback.

To correct this you can add some code to your pages that will remove the second instance of the ad.

Instructions

  1. Create a js file (i.e. clicktale-adsense.js) and include the following code in it
    function ClickTaleRemoveAdsenseFrame()
    {
      if (typeof ClickTaleIsPlayback != 'function' || ClickTaleIsPlayback() )
      {
        var c=document.getElementsByName('google_ads_frame');
        if(c.length)
        {
          var e=c.item(c.length-1);
          e.parentNode.removeChild(e);
        }
      }
    }
  2. Include this js file by adding the following line in every html page where you have adsense ads
    <script type="text/javascript" src="clicktale-adsense.js"></script>
  3. After each block of adsense add the following code
    <script type="text/javascript">ClickTaleRemoveAdsenseFrame();</script>

Note: a block of adsense ends with a

<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

Advanced note: if you only have one block of adsense, you can execute the body of the function inline right after the ad block and not use an additional file.

Q: Why do my Google AdSense Frames say "ClickTale Adsense Frame" on the heat maps?
A: This means we replace your Google AdSense banner with this frame at the time of playback so that it doesn't count as wasted impressions in your AdSense program.