Friday, April 24, 2009

http://www.w3.org/TR/html4/strict.dtd">Code Implementation Guide - AdSense Help https://www.google.com/favicon.ico" /> https://www.google.com/adsense/support/bin/resource/helpcenter_global_static.css?v=42" /> https://www.google.com/adsense/support/bin/resource/helpcenter_layout.css?v=18" /> https://www.google.com/adsense/support/bin/resource/search.css?v=8" /> https://www.google.com/adsense/support/bin/resource/request.css?v=2" />

AdSense Help

Code Implementation Guide

We understand that copying and pasting your AdSense code can sometimes be confusing, especially if you're new to HTML and webdesign. This guide will cover some HTML basics, give two examples of pasting code using two different types of web editors, and discusscommon problems you might experience after pasting the AdSense code.

Note: If you'd prefer a video tutorial rather than a written walkthrough, you can view our href="http://services.google.com/adsense/breeze/troubleshooting/2059761/index.html?sourceid=asos&subid=ww-ww-et-hwac_guide&mediu
m=link">Help with Ad Code Demo (English only), a visual presentation which covers the same material as this guide, beginning onslide 7.

This guide covers many topics, so feel free to skip ahead to a specific section:

  1. Copy your AdSense code
  2. Paste your AdSense code
  3. HTML Basics
    a. How to view your source code
    b. What to look for in your HTML source code
  4. Paste using WYSIWYG editors
    a. Using Code View
    b. Using HTML Insert
  5. Common Problems
    a. Paste your code exactly
    b. Look for extra HTML added
    c. Be patient after pasting your code
    d. Use ad formats that fit your site layout
  6. Additional Resources
1. Copy your AdSense code

First, you will need to locate your AdSense code, found in the Your AdSense code box which is located on the 'Get Ad Code'page under the AdSense Setup tab in your account pages. This is the code you will copy and paste into your site's HTML sourcecode.

href="#3">step 3.

In order to display Google ads on your website, it is very important that you copy the ad code exactly as it appears on the AdSenseSetup tab of your account and paste it directly into the HTML source code of your webpages, without any modifications. Modifying thead code is against our program policies and may also result in errors on your page.

After copying your AdSense code, return to your desktop and open your HTML editor. Once you've accessed your HTML source code,click on the spot where you'd like to place your ad code and then select Paste from the Edit menu.

When you've finished pasting the code into the webpages, you'll need to save changes and upload or publish the updated pages toyour server. If you have difficulty uploading to your server, please contact your webhost. Keep in mind that after you've pasted the ad codeinto the HTML source of your page, it must look exactly the same as the ad code displayed in your AdSense account.

If implemented correctly, Google ads should appear almost immediately.

Back to top

3. HTML basics

If you're unfamiliar with HTML, allow us to give you a little background. HTML (Hyper Text Markup Language) is the programminglanguage in which webpages are written. This coding language is used on the World Wide Web. Web browsers read HTML in order todisplay the contents of a page.

3a. How to view your source code

If you would like to view an HTML document (also known as the 'source code'), first open your web browser. Then go to a page whosesource you would like to see and click View on the menu bar at the top of the screen. Next, select Source if you're usingInternet Explorer

http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_03_view_source_large_en.gif">
src="
http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_03_view_source_small_en.gif" alt="View Source in Firefox"
border=0>

The HTML document containing the source code of that page will appear on the screen.

3b. What to look for in your HTML source code

Every HTML document consists of bracketed tags which tell the web browser how to display the HTML elements. All HTML elementsstart with an opening tag (< >) and end with a closing tag (</ >). All HTML documents have the following basic structure:

<HTML>

<HEAD>
</HEAD>

<BODY>




</BODY>
</HTML>

The opening <HTML> tag alerts a browser that this is the start of your HTML document. The opening <HEAD> tag containsyour header information and is not visible when you view the page in your browser. Any text displayed between the BODY tags(<BODY> and </BODY>) will be displayed in your browser. The closing </HTML> tag alerts your browser that this is the endof your HTML document.

For ads to appear properly, you will need to place your ad code between the opening <BODY> and closing </BODY> tags ofyour source code.

If you are experiencing difficulty finding the <BODY> tags, try pressing the 'CTRL' and 'F' keys on a PC, or 'COMMAND' and 'F'keys on a Mac to open a Find text box. Then type '<BODY' (without the quotes) to find the opening tag or '</BODY' (withoutthe quotes) to find the closing tag, and click Find next.

Back to top

4. Paste using WYSIWYG editors

If you're using a design-enhanced HTML editor, often referred to as WYSIWYG (What You See Is What You Get), it may use aCode View feature which contains HTML, Design/Normal, and Preview views. Or, your editor may use an HTML Insertfeature which utilizes an 'Insert' menu tab. If you are unable to locate the HTML source code of your webpage in your WYSYWIG editor,please contact the support group for your HTML editing software for specific instructions on how to locate this view.

In the following sections, we'll show examples of pasting AdSense code using both Code View and HTML Insert. Because every editoris different, and because only you know how you like to build your webpages, we're unable to give you exact instructions for pasting your adcode. However, we hope you'll find these examples helpful.

You may also wish to see how other publishers implement AdSense using your specific HTML editor at the href="AdSense'>http://groups.google.com/group/adsense-help?sourceid=asos&subid=ww-en-et-homepage&medium=link">AdSense Help Forum(English only).

4a. Using Code View

If your web editor uses a Code View feature, please follow these instructions for pasting your AdSense code.

Using your editor, open the webpage on which you'd like to display AdSense. In the Normal or Design view, select thelocation in your document where you want to place AdSense. In this example, we will be placing a leaderboard ad unit below the title.

http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_01_code_box_large_en.gif">
src="
http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_01_code_box_small_en.gif" alt="Code Box"
border=0>

In your editor, switch to the HTML view. Paste the ad code between the <BODY> and </BODY> tags -- where the cursor isblinking. Pasting the ad code outside the <BODY> tags will prevent the ads from appearing correctly.

http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_07_preview_large_en.gif">
src="
http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_07_preview_small_en.gif" alt="Preview" border=0>

If you're satisfied with the results, go to File in your menu and click Publish Web.... This will upload your website ontothe web with the Google ads implemented.

http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_01_code_box_large_en.gif">
src="
http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_01_code_box_small_en.gif" alt="Code Box"
border=0>

Next, using your editor, open the webpage on which you'd like to display AdSense. Click the Insert option on the toolbar, thendrag down and click HTML.

http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_11_html_code_box_large_en.gif">
src="
http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_11_html_code_box_small_en.gif" border=0 alt="HTML Code
Box">

After doing so, a new HTML box will appear. You can move this box to any location on your website, but you cannot overlap the HTMLbox with any other text or graphic box on the website. Overlapping will prevent your ads from appearing or create errors when you uploadthe website. Also keep in mind that you can adjust the size of the HTML box to fit your layout. In this example, we have resized the HTMLbox so that the skyscraper ad code will fit into the sidebar of this webpage.

http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_13_file_preview_large_en.gif">
src="
http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_13_file_preview_small_en.gif" border=0 alt="File
Preview">

In this case, you can see the skyscraper ad unit implemented in the right-hand side of the page. Please be sure to pick an ad formatthat will fit into a blank space on your site.

http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_15_publish_site_large_en.gif">
src="
http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_15_publish_site_small_en.gif" border=0 alt="Publish
Site">

Back to top

5. Common Problems

After pasting your AdSense code and publishing your webpage, you may see public service ads or no ads at all for up to 48 hours. Ifyou continue to experience difficulty with your ads after waiting 48 hours, you can troubleshoot the ads yourself by reading the followingsections.

5a. Paste your code exactly

If you don't see an ad unit appearing on your site, or if you see an error on your site, such as the HTML ad code appearing, check theHTML source code of your site to make sure the AdSense code on your site looks exactly the same as the AdSense code in your accountpages.

To check the HTML source of your webpage, follow these steps:

  • Open a browser window and view your webpage.
  • Under your browser's View tab, select Source in Internet Explorer or Page Source in Firefox. A text documentdisplaying the HTML code of your site will pop up.
  • Press the Ctrl and F keys, or the COMMAND and F keys if you're using a Mac. This will bring up a Find box. Type 'google_ad'into the box and press 'Enter' to locate your ad code.
  • Next, open your AdSense account in a new browser window and go to the Your AdSense code box, under the AdSenseSetup tab. On your screen, place your HTML source code alongside the ad code in the Your AdSense code box. Compare thead code and ensure that it looks exactly the same on both pages.

The most common reason publishers do not see their ads is that the code was copied incorrectly.

5b. Look for extra HTML added to your ad code

If the ad code in the source of your live site appears differently from the ad code in your account, it may be that your webhostautomatically includes or changes certain tags when you place code onto your site. You may see that extra HTML code such as'<BR>' or &nbsp tags have appeared in your ad code, as in the examples below. The ad code may also be reformatted to appear inone line. In addition, sometimes the "Javascript" declarations have been removed from your ad code.

If you are confident that you pasted the code into the HTML view of your WYSIWYG editor exactly as it appears in your account, youshould contact your webhost about any changes you see to the ad code, such as reformatting or extra tags.

5c. Be patient after pasting your ad code

If you see public service ads (also known as PSAs) after placing your ad code, you may simply need to give our crawler an opportunityto visit your site. This generally occurs within 30 minutes of implementing the ad code, but can take as long as 48 hours. When your pageis viewed and the Javascript code is executed, our crawler is called to your pages. For this reason, we recommend visiting each of thepages on which you' page ad a continue href="http://www.google.com/services/troubleshooting/cookies_cache.html">Troubleshooting Wizard or href="answer.py?answer=10035">Help Center.

5d. Use ad formats that fit your site layout

If you use an inappropriate ad format, your site's layout can be affected. For example, in the following example, a square or skyscraperformat will push the content of this page down.

http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_19_correct_format_large_en.gif">
src="
http://www.google.com/images/adsense/en_us/support/CodeImpGuide/ci_19_correct_format_small_en.gif" alt="Correct Format"
border=0>

6. Additional Resources

Here are a few links to some helpful resources. We encourage you to visit these pages for more information and details about theAdSense program.

Back to top

The information you were looking for?

Print

https://www.google.com/adsense/g-app-single-1?&sourceid=aso&subid=ww-ww-et-helpcenter%20&medium=link" method="post" name="applyform">

New email notification preferences

Would you like to receive customized help and performance suggestions? With our new email notification preferences, you can. https://www.google.com/adsense/lang-change">Sign up now.

Announcements and alerts

Get news and updates from the AdSense team on Twitter! Follow us at a><>Newbie Module?, Combo>http://www.google.com/options/icons/directory.gif) no-repeat 0 .2em" href="http://www.twitter.com/adsense%22%3Etwitter.com/adsense%3C/a%3Ehttp://www.twitter.com/adsense%22%3Etwitter.com/adsense%3C/a%3E%3C/strong%3E%3C/p%3C/a%3E%3E%3C/div%3E %20%3Cdiv%20class=%22module%22%3E %20%3Ch2%3EHelp%20resources%3C/h2%3E %20%3Cul%20class=%22comboMod%22%3E %20%3Cli%20style=%22background:url(%3Ca%20href=%22http://www.google.com/help/hc/images/babyblocks-35.gif%22%3Ehttp://www.google.com/help/hc/images/babyblocks-35.gif%3C/a%3E)%20no-repeat%200%20.2em%22%20class=%22no_subtext%22%3E%3Ca%20href=%22/adsense/support/bin/answer.py?answer=81558" images www.google.com http: and

  • a><>Demos >http://www.google.com/help/hc/images/wrench_E5ECF4.gif) no-repeat 0 .2em" class="no_subtext">Ad Troubleshooting
  • http://www.google.com/help/hc/images/siteissues-32.gif) no-repeat 0 .2em" class="no_subtext">Known issues
  • http://www.google.com/options/icons/code.gif) no-repeat 0 .2em" class="no_subtext">Optimization Tips
  •