Add Google AdSense code to WordPress

Google AdSense is probably the most popular service to monetize a website. With Auto ads, it’s easy to add AdSense to WordPress and start making money. You can focus on creating content and Google will do the rest.
You just need to insert the ad code in your WordPress site once. Using machine learning technology, Auto ads analyze your content and automatically place and optimize your ads.

Adding ads to WordPress should be a “Plugin Territory” functionality: this means that the users will be able to switch WordPress themes without losing their Ad code.

In this article, we will show you how to add AdSense code to WordPress.


Add your site to your sites list

First make sure you add your site to your sites list.
To access your sites list: sign in to AdSense, and click Sites.
After adding a new site, you need to wait for some checks from Google to verify you’re the site owner and that your site complies with the AdSense Program Policies.
It could take a few days before your site is ready to show ads.


Set up Auto ads

Sign in to your AdSense account and go to “My Ads » Auto ads“.
On the “Auto ads” page, click Get started.
On the “Choose global settings” page choose which ad formats you’d like to show. Leave the “Automatically get new formats option” enabled if you want to use new formats.


Get and copy your ad code

Copy the code from the “Place code on your page” box.


How to insert ad code in your WordPress site

Install and activate “Insert Headers and Footers” plugin. It’s a simple plugin that lets you insert code in the header and footer.

add adsense code to wordpress

Once the plugin is activated, go to Settings » Insert Headers and Footers from your WordPress Dashboard, paste the AdSense code in the “Scripts in Header” box and save.