Saturday, April 15, 2017

How to get Google Adsense Leaderboard working in XHTML

Getting Google Adsense working in XHTML took me a while to figure it out.  I share the process with you here...

1) Create an ad-leaderboard.html file, similar to this:


<html>
    <head>
        <title>Gliesians Leaderboard</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width">
    </head>
    <body>
        <div>
            <script type="text/javascript"><!--
   google_ad_client = "ca-pub-XXXXXXXXXXXXXXXX";
                /* Mobile Ad */
                google_ad_slot = "XXXXXXXXXX";
                google_ad_width = 728;
                google_ad_height = 90;
                //-->
            </script>
            <script type="text/javascript"
                    src="//pagead2.googlesyndication.com/pagead/show_ads.js">
            </script>
        </div>
        <br/>
    </body>
</html>




2) Call the ad-leaderboard.html file from your xhtml file like this:



<div>
  <object data="/ad-leaderboard.html" type="text/html" style="width: 790px; height: 135px; padding: 0; ">
  </object>
</div>



That's it!  If you have any issues getting it to work, let me know and I'll try to help.

No comments:

Post a Comment

The source code for gliesians.com is for sale on Ebay.

I've decided to shut down gliesians.com and sell the source code. If anyone is looking to purchase the related source, you can find it...