Code implementation guide

Where to paste the AdSense ad code in your HTML

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







The opening <HTML> tag alerts a browser that this is the start of your HTML document.

The opening <HEAD> tag contains your 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 end of your HTML document.
For ads to appear properly, you need to place your ad code between the opening <BODY> and closing </BODY> tags of your source code.

If you're having trouble 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' (without the quotes) to find the closing tag, and click Find next.

Finding the <BODY > tags is important, because you need to paste the AdSense ad code in between the <BODY> and the </BODY> tags of the document.

Position the ads on your site with HTML

Just like other elements of your website such as images and photos, you can change the position of your Google ads by using HTML tags.

For example, if you surround your AdSense ad code with the tags <div align="center"> and </div>, the ad unit will be centered on your webpage. You can also place the complete content of your page into a HTML table and change the location of the ad unit by positioning it in a specific table cell.

Was this article helpful?