Join Paypal

Sign up for PayPal and start accepting credit card payments instantly.

Adding Google Adsense To Your Web Pages

Adding Google Adsense To Your Web Pages

There a many ads on the web for ready made Google Adsense Sites. However its really very easy to add Google ads to your web pages as we shall see.

The Google Adsense code is basically a JavaScript. The code is generated by Google and all you need to do is to copy the code and paste it on your web page. I always copy the code into notepad and store in locally on my machine and that way I can reuse it without having to get it from Google each time.

Google allows you to customise the look and feel of you Adsense ad with different colours and backgrounds, sizes and channels. When I create a new ad, perhaps with a different colour, I paste it into notepad and save it with a descriptive name . All Google Adsense ads for each web site I manage are stored in separate directories. The directories looks like this:


Where 250 is the ad size, byo is the website, white refers to the background colour etc.

Here are the contents of one of those files. Notice the comments at the top at bottom (marked in yellow). These I added to make the ads easier to find and so that I know which ones they are.


In addition to adding comments I also often enclose the code in a table so that I can position it correctly. I make the table width and height match the Google ad size. In the code above I would add the table as shown below ( marked in red).

Add Google Adsense Code -3

You should notice that the above code is set to align to the left. I can position it on the page by simply changing it to right or center.

To insert the code into you page position your cursor in the location you want the code to appear and then switch to source or HTML mode and then copy and paste from the notepad file. Once done switch back to normal mode.

It is a good idea to preview the code just to make sure it is positioned correctly. However the preview on your local machine doesn't display more than one ad unit on the page and this will contain a public service ad. This isn't really a problem as all we really want to do is to make sure the page appears ok.