Code implementation guide
How to paste Adsense code in your website page
After you’ve copied the ad code from your AdSense account, the next step is to paste it in your page’s HTML source code. How you go about this will depend on the tools you use to edit your site.
Note: Before adding the ad code to your page, make sure that your page complies with the AdSense Program policies. If your page doesn’t comply with these policies, we reserve the right to disable ad serving to your site and/or disable your AdSense account at any time.
HTML editors
Many publishers use a design-enhanced HTML editor like Macromedia Dreamweaver (also know as WYSIWYG or “what you see is what you get” software). To ensure your ads work properly, make sure you paste the ad code into the HTML source code of your page using the editor’s HTML view or HTML insert function. You might see errors if you paste your ad code into a WYSIWYG view such as a “Design” view. Once you’ve pasted your code, check for any additional tags inserted by the software or changes in the line breaks, as they might cause your ads not to show correctly.
If you can’t find the HTML source code of your page in your editor, visit the help center or support group for your HTML editing software.
Content management systems (CMS)
If you’re using a content management system, check below to see if your CMS has AdSense built in or if it supports a plugin that can help you to implement your AdSense ad code.
Sites with AdSense built in
CMS software with unofficial plugins
The following content management systems (CMS) use third-party plugins to insert AdSense ads on the pages generated by the system. Google does not endorse or support these plugins. However, you can use these plugins as long as the ad code displayed on your page remains unchanged and is not altered by the plugin in any way.
WordPress user? Get help with adding AdSense code.
If you need assistance with a plugin, visit the official support forum of your service or the developer of the plugin. Note that Google is not responsible for malicious third-party plugins.
PHP sites
While AdSense ad code does contain JavaScript variable declarations, it’s actually a block of HTML code compatible with most PHP sites. For help with implementing the ad code on a PHP site, we recommend searching for online resources using terms such as “adsense php“.
Give Feedback About This Article