There are several ways to place Google AdSense ad code into your WordPress site. Here, you’ll find information about some of the ways you can do this.
Connecting your WordPress site
If you’re new to AdSense, one of your first tasks is to connect your site to AdSense. This requires you to copy the code on your AdSense homepage and paste it into the HTML of your page, between the and tags. To do this in WordPress, you can either:
- Use a plugin to insert the code. You can use one of the plugins that lets you make changes to the “header” of your site
- Or, place the code through your WordPress theme settings. We recommend not editing theme files directly. If the theme you edit is updated, your changes will be overwritten.
Your existing plugin or theme may have a feature for inserting the code. Here are some additional resources from partners that you may be already using:
- Genesis themes
- Insert Headers and Footers plugin
- Advanced Ads plugin
- Ad Inserter plugin
Be aware that not all themes and plugins allow you to insert code into your site’s header. Note that Google is not responsible for malicious third-party themes or plugins.
Note: Before adding the ad code to your page, make sure that your page complies with the AdSense Program policies. Note that Google may disable ad serving and/or disable your AdSense account at any time if Google finds your site or ad placement is not in compliance with its policies.
How to add Auto ads code
Auto ads are a family of ad formats that offer a simple and innovative way for you to monetize your content. To complete the steps to set up Auto ads on a WordPress site, you need to copy and paste the Auto ad code between the and tags of your site.
Auto ad code is the same type of code you added when you connected your site to AdSense. You can use any of the options described in the Connecting your WordPress site section above to add your Auto ad code.
How to insert ad code on your AMP pages
Accelerated Mobile Pages (AMP) is an open source initiative to enable a better web, with sites that are fast, beautiful, and monetize well.
Creating an AMP version of your WordPress site
To create an AMP version of your site, we recommend you use the AMP for WordPress plugin. AMP for WordPress is an open source plugin that Google has contributed to.
After you’ve installed and activated the plugin, choose your template mode:
- Native: Choose if you want to have a single AMP version of your site
- Paired: Choose if you want to have both AMP and non-AMP versions of your site
- Classic: Choose if your WordPress theme is not AMP-compatible.
If your WordPress theme is AMP-compatible, you can choose from any of these modes. If you want to test AMP first, you can start with Paired. After testing, you can switch from Paired to Native anytime by visiting your AMP for WordPress plugin settings.
Inserting ad code on your AMP pages
After you’ve created your AMP site, you can show ads on your AMP pages. Depending on the template mode you selected in the AMP for WordPress plugin, there are different methods you can use to insert your ad code. If you’re unfamiliar with coding, you might want to use an ad plugin or a theme to insert your ad code.