Clear search
Close search
Google apps
Main menu

Code implementation guide

Paste the ad code in your page

Once 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.

Before adding the ad code to your page, please 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, please 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 official Google plugins

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.

If you need assistance with a plugin, please visit the official support forum of your service or the developer of the plugin. Please note that Google is not responsible for malicious third-party plugins.

If you have trouble implementing AdSense with a specific content management system, we recommend searching for the name of the CMS (e.g., Drupal, WordPress, etc.) and "AdSense implementation". You can also ask in the forum if other publishers have mastered similar problems, or contact your program provider directly.

Have any questions?

Ask the community

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".

Mark is an AdSense technical expert and the author of this help page. Help him improve this article by leaving feedback below.

Was this article helpful?
How can we improve it?
Sign in to AdSense

Sign in to AdSense to see help for your account

Don't have an AdSense account? Sign Up for AdSense!