Adding the AdSense code to your web page is a very straight forward process. You just need to copy the AdSense code from your AdSense account (as seen in the AdSense code box) and paste it in your html code. However, there are certain guidelines that you need to follow when pasting the AdSense code in your web page.
Firstly, you should never tamper with the AdSense code in any way. It should be pasted as such, in its entirety, without any changes or modifications; otherwise your AdSense code will not work. Moreover, you might end up violating the AdSense program policies.
Also, it’s important that you paste the AdSense code in the body tags of your html page. This is necessary for the code (java script) to run properly.
Further, you must ensure that you use a maximum of three ad units per web page (this is the limit specified by Google AdSense program) and not more than 1 link unit per web page.
Since content based Ad targeting is the main concept behind AdSense program, you need to ensure that you paste your AdSense code in the place where you have your main content pieces e.g. if you have your main content in a particular frame or a ‘DIV’ tag, your AdSense code should be pasted in that particular frame or ‘DIV’ tag.
Be careful when using WYSIWYG editor (What you see is what you get) editors. Such editors sometimes add few tags on their own. So, paste the AdSense code only in source code directly and not in the preview page or any other view of your web page. Always check the AdSense code for additional irrelevant tags before you actually upload your web page to your server.