Home Tutorials How to Add Google AdSense to Your WordPress Site

How to Add Google AdSense to Your WordPress Site

There are numerous methods to monetize your WordPress web site, comparable to internet affiliate marketing and displaying adverts. In reality, displaying adverts in your web site can earn you a large amount of cash relying in your technique and visitors figures.

So far as adverts platforms go, Google AdSense is without doubt one of the greatest choices for many WordPress web sites. It’s straightforward to arrange, and because the platform has many advertisers, you’re ready to match your web site with adverts which might be related to your guests.

On this tutorial, we’ll speak about how Google AdSense works and the way to get advert codes. Then I’ll present you ways to add Google AdSense to WordPress each manually and with a plugin. Let’s get to it!

How Google AdSense Works

The Google AdSense home page.

AdSense is an advert community anybody with an internet site can be part of. As such, if AdSense approves your web site, you can begin to show adverts from its community on it. When you’re in, AdSense pays you both for clicks or impressions on the adverts you show. 

Each advert within the community comes from Google Advertisements publishers. This can be a separate platform designed solely for entrepreneurs. It allows them to arrange campaigns and adverts that seem on web sites comparable to yours.

In apply, Google offers entrepreneurs a broad vary of instruments to make sure that solely related audiences see their adverts. This is good news for you as a result of it signifies that the adverts you present in your web site can be related on your guests.

If you’d like to be part of Google AdSense, you want to apply to the platform with an current web site. Ideally, the web site ought to have already got some content material and an current viewers. With out first rate visitors, you’re not going to make a lot cash from adverts, whatever the community you employ.

As soon as your web site will get reviewed and accepted (which might take a few days), you’re prepared to begin placing adverts on it.

How to Add Google AdSense to Your WordPress Site (2 Methods)

You may publish AdSense adverts in your WordPress web site both utilizing a plugin or manually.

In each circumstances, you want to get a snippet of code from AdSense. Let’s take a look at this step first.

1. Get Your Google AdSense Advertisements Code

In broad phrases, AdSense allows you to put up adverts in your web site utilizing two approaches:

  1. Handbook adverts – You may configure advert zones on your web site and resolve the place to place them.
  2. Auto adverts – AdSense decides what number of adverts to show on every web page and the place to present them (though it does offer you some management over advert limits).

In both case, AdSense decides which adverts to present in your web site. Because the computerized possibility allows you to resolve which pages to present adverts on and set a restrict, it’s the strategy I like to recommend.

You may allow the auto adverts function for any of your websites by accessing your AdSense account and going into the Advertisements > Overview display.

From right here, click on the Edit button subsequent to your web site and allow the Auto adverts function. Now, you’ll see a code snippet related to the next one:

An example of the AdSense auto-ads code.

After you have the code, it’s time to place it inside WordPress — and there are two methods to do it.

2a. Use a Plugin to Add the Google AdSense Code

Google AdSense’s auto-ads code ought to go inside your web site’s header.

The best method to add customized code to WordPress is through the use of a plugin comparable to Header, Footer and Submit Injections:

The Header, Footer and Post Injections plugin

The plugin is remarkably straightforward to use.

As soon as it’s put in and activated in your web site, click on the Settings > Header and Footer possibility in your WordPress admin. You’ll see the next display:

Adding code to your website's header

All you want to do is copy the auto adverts code you generated with Google AdSense and paste it inside one of many fields below <HEAD> PAGE SECTION INJECTION.

Right here, you’ll see an possibility to embrace the code inside all your pages or simply your own home web page. If you’d like to maximize advert income, I like to recommend the previous possibility.

When you paste the code, save the modifications — and that’s it! Google adverts ought to begin to present up in your web site instantly.

2b. Add the AdSense Code to Your Theme’s Header Manually

If you’d like to add customized code to your web site’s header manually, the easiest way to do it’s through an FTP (File Switch Protocol) shopper comparable to FileZilla. This allows you to join to your web site and edit its information far more simply than out of your WordPress dashboard.

For this state of affairs, you’ll want to edit your theme’s features.php file and ideally use a baby theme. That method, your customized code, comparable to your Google adverts, gained’t disappear when you will have to replace your theme (which occurs usually).

To get began, entry your WordPress root folder and go to wp-content/themes. Search for your theme or baby theme’s folder inside and open it. Try to be ready to spot a file known as features.php inside:

A Cyberduck window showing the functions.php file

Proper-click on the file and discover the choice to open it. This may open the file utilizing your default textual content editor.

To put your Google AdSense code inside your web site’s header, you want to add the next code snippet to your features.php file:

add_action('wp_head', 'adsense_code');
operate adsense_code() {

    <!-- Your AdSense code goes right here. -->


You may change the operate’s title from adsense_code() to no matter you favor.

That’s it! Should you ever want to take away Google adverts out of your web site, merely take away the code out of your features.php file or disable the kid theme.


When you’ve got an internet site that will get numerous visitors, adverts are among the best methods for you to monetize your viewers.

With Google AdSense, you get entry to what is maybe the most important advert community on the earth. This implies you possibly can show adverts that your viewers will discover related, and what’s extra, payouts ought to go off and not using a hitch to boot.

Studying how to add Google AdSense to WordPress is simple, and you should use both of those two approaches:

  1. Use a plugin to add the Google AdSense code.
  2. Add the AdSense code to your theme’s header by means of the features.php file.

Do you will have any questions on how to add Google AdSense to WordPress? Let’s speak about them within the feedback part beneath!