How to place google adsense code on web pages - HashOut

How to place google adsense code on web pages

I know that this post might sound silly, but there are indeed people coming to this blog searching for "step-by-step procedure to place google adsense code in our web pages". It's not necessary that all of them out there are an expert like you. So if you're new to HTML and web design, here is a guide to add adsense code to your webpage.


  1. The first step is to get your AdSense code.

    1. Sign in to your AdSense account
    2. Click AdSense Setup
    3. Click AdSense for content
    4. Choose the ad type you want then click Continue
    5. Choose the ad format and colors then click Continue
    6. Choose or create new channel(s) for the ad then click Continue
    7. Click anywhere on the Your AdSense code: box. The entire code will automatically be highlighted / selected. You'll know the code has been selected when the entire contents of the box are highlighted in blue. Now copy the highlighted code (Press Ctrl+C on a Windows PC or right click and click copy or from your browser's Edit menu, choose Copy in order to copy the highlighted area.).


  2. Now we'll proceed to paste the copied code to the HTML source of the webpage.

    HTML (Hyper Text Markup Language) is the programming language used to write web pages for the World Wide Web (WWW). Web browsers use HTML to interpret and display the contents of the web page. All HTML documents consist of elements contained within bracketed tags which tell the browser how to treat the contents of the element. Most HTML elements are contained within an opening tag <XXX> and a closting tag </XXX> where XXX is the tag identifier like HTML, HEAD, BODY, TABLE, DIV, SPAN etc. Some elements do not have a closing tag and are represented by the <XXX/> tag like BR, IMG etc. An HTML document has the following basic structure:

    <HTML>
    <HEAD>

    </HEAD>
    <BODY>

    </BODY>
    </HTML>

    The opening <HTML> tag indicates the start of an HTML document. The header information is enclosed between the HEAD tags (<HEAD> and </HEAD>) and is not displayed when you view the page in a browser. Any text between the BODY tags (<BODY> and </BODY>) is displayed in the browser. The closing </HTML> tag indicates the end of the HTML document.

    We need to place the ad code between the opening <BODY> and closing </BODY> tags of the source code.


    1. Open / Run your HTML editor
    2. Open your HTML source code file (Usually a .htm or .html file and if you are using server side scripting then the web page file would usually have a .asp, .jsp or .php file extension).
    3. Click to place the cursor on the spot where you want to place your ad. Now click Paste from the Edit menu.
    4. Once you've finished pasting the AdSense code in all the desired locations (currently you can have a maximum of three AdSense ad units on a page.), save the page and upload or publish your updated web page(s) to your web server.


Please note that the AdSense code which you pasted should look exactly the same after saving and publishing the page(s), else it might violate the AdSense Terms of Service (TOS) and might not even show the desired result.

If you enjoyed this post then Bookmark or Subscribe to HashOut for FREE!

Read more on ,