Adding Google AdSense Ads

Using Google ads in websites and templates

Google AdSense support
You can add advertisements like Google AdSense (banner and text ads) to any Allwebco template HTML page, as well as adding other non-Google ads. Add the code directly to your main HTML pages.

See Also…

Responsive AdSense HTML Webpage Templates

Getting started
Google AdSense ads for websites are available to anyone. The code is generated in your Google login and is copied and pasted into your HTML webpages. The ads automatically detect the theme or product details on your website by reading the text on your webpages, and will then display ads related to your website.

Before you start
Make file backups of your webpages. Be sure to check the Google AdSense policies on the Google site before you place any ads on your website. Do NOT click on your own ads!

Example: The AdSense code
Below is an example of the ad code you'll generate in your AdSense account.

Do NOT copy or use the following code on your website. Generate your code in your AdSense account login.

<script async src="//"></script>

<ins class="adsbygoogle"
(adsbygoogle = window.adsbygoogle || []).push({});

Option #1: Adding to HTML pages
Simply paste the Google ad code you generate in your account inside any HTML page. Place the code inside the "MAIN CONTENT" OR "SIDEBAR" areas in your main HTML pages (do NOT place code in a footer.htm or sidebar.htm). You can generate many different ad sizes as well as create responsive ads (see help in your account login).

Option #2: Use in an absolute positioned DIV
You can use a "div" to "re-locate" any item in an HTML page, including Google ads, and locate the ads anywhere on the page using CSS code. Do NOT make the DIV a fixed div so it scrolls with the page (position:fixed). It is not allowed by Google policies. See: Add an absolute located DIV.

Option #3: Adding to a sidebar area (not in a sidebar file)
You can place your ads in the sidebar area if your template includes a "sidebar.js" or "sidebar.htm" without putting the code in the .js or .htm file. You can either remove the code shown below and put your Google code in this area, or paste your Google code above, or below the code indicated below in each HTML webpage. (NOTE: Templates include both types of code shown below.)

Code if your template includes a "sidebar.js" or "sidebar-right.js" or left ,js file:

<script language="JavaScript" type="text/javascript" src="sidebar.js"></script>


Code if your template includes a "sidebar.htm":

<iframe name="Sidebar" src="sidebar.htm" width="187" height="600" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" class="sidebar-frame"></iframe>


Sidebar code for templates with jQuery "includes":

<div data-load="includes/sidebar.htm" class="incld"></div>


Do NOT use in a sidebar.htm or footer.htm
Google policies indicate that you should not place ads in any framed or IFramed pages. Place the code only in your main website or template HTML webpages.

Troubleshooting problems
  • Note: Ads may not work off-line. Try uploading to test them.
  • Google approval may take a few hours. Once approved it usually takes about 15 minutes for new ads you create to start working. Login to your Google account to check if you are approved.
  • If you are adding Google ads and they are not displaying, you may have placed too many of one type of ad on a page. Try adding a different ad type to the page. As far as we can ascertain, you can place only 3 ads on a page and 3 link units.
  • If your ads are not working, try generating a new ad in your Google AdSense account and replace the template ad code with your generated ad.
  • Place your ads ONLY in top level HTML pages. Do not place AdSense ads in .js files or in IFrame pages or in jQuery "include" files in the "includes" folder.
  • If you place an ad in a template "sidebar.htm" (not recommended) be sure to check your Google account to make sure the ads are working and generating clicks.
  • You may need to check Google support, or contact Google for any other problems with your AdSense account. Allwebco is not affiliated with Google.