Unlimited Wordpress themes, plugins, graphics & courses! Unlimited asset downloads! From $16.50/m
  1. Web Design
  2. WordPress

How to Add Google AdSense to WordPress

Read Time:4 minsLanguages:

Google AdSense is one of the best ways to monetize your website. In this article, I'll show you how to set up AdSense to show ads on your WordPress website.

With Google AdSense, you can place ads in the site header, footer, sidebar, or in-between. The ads that are served by Google are contextual to your website content. The concept is very simple: when someone clicks on any ad served by Google, you’ll get paid!

To set up Google AdSense on your WordPress website, there are a couple of steps that you need to follow:

  • Create a Google AdSense account and connect your website to it.
  • Configure your ad unit codes.
  • Insert ad codes on your WordPress website.

From the next section onwards, we’ll discuss each of the above steps briefly.

Create Your Google AdSense Account and Connect It With Your WordPress Website

To be able to use Google AdSense on your website, you need to create a Google AdSense account in the first place.

Go ahead and sign up for your Google AdSense account. Click on the Get Started button, follow the steps, and fill in the required information. Finally, you’ll end up on the page shown in the following screenshot.

Get AdSense Verification CodeGet AdSense Verification CodeGet AdSense Verification Code

Basically, Google is asking us to verify the ownership of the website for which we want to use Google AdSense. For that, we need to copy the code shown in the above screenshot to our WordPress website. Keep this page open in the meanwhile, as you’ll need to get back to this page once you've added the code to your website.

Now, let’s see how you can add the verification code to your WordPress website. Head over to the admin side and go to Appearance > Theme Editor. On the right-hand side, click on the Theme Header link under the Theme Files section. It will open the header.php template file, and you just need to add the verification code as shown in the following screenshot.

Add Verification Code to WordPressAdd Verification Code to WordPressAdd Verification Code to WordPress

Click on the Update File button to save your changes.

Now, go back to the Google AdSense page, tick the I've pasted the code into my site box, and click on the Done button. You’ve now completed the verification process from your side.

Google may take a few days or weeks to approve your account. After your account is activated, you can start configuring ad unit codes and showing ads on your website.

Get Your Ad Unit Codes

Once your account is activated, you can start configuring ad unit codes by accessing AdSense dashboard.

There are two ways you can place Google ads on your website:

  • by site
  • by ad unit

The By site option allows Google to display ads automatically on your website by just inserting a single <script> snippet on your website. If you want to use this method, click on the Get code button under the By site tab, and add this code to your website in the same way the verification code was added in the previous section. And you’re done—you don’t need to do anything more in this case!

On the other hand, the By ad unit option allows you to configure ad units manually, and thus, it gives you more control over how and where you want to display ads on your website.

To create ad unit codes, go to Ads > Overview and choose the ad type under the By ad unit tab. Finally, give a name to your ad, select the size of your preference, and create the ad unit. When you’re done, you’ll get a code which you need to embed on your website.

In the next section, we’ll see how you could embed ad unit codes on your WordPress website.

Insert Ad Unit Codes on Your WordPress Website

Once you’ve created ad units and collected ad unit codes from Google AdSense, the last step is to add it to your WordPress website.

Head over to the admin side and go to Appearance > Widgets. In our case, we need to use the Text widget as we have to add the custom HTML code. Drag the Text widget from the left side and drop it onto the position where you want to show it. In the following screenshot, I’ve decided to show the ad in the footer-2 position. Next, insert your ad unit code into the editor.

Add Ad Unit Code to WordPressAdd Ad Unit Code to WordPressAdd Ad Unit Code to WordPress

Finally, click on the Save button to save your changes. And now, you’ve successfully configured the ad unit code on your WordPress website! In the same way, you could go ahead and configure multiple ad unit codes in different places like the header, footer, and other places on your website.

So that’s how you can monetize your WordPress website with Google AdSense. It’s very easy to use, and you can get started with it right away!


Today, we discussed how you could monetize your WordPress with Google AdSense. If you want to learn more about WordPress, check out some of our other posts.

If you want to learn how to make a WordPress site from A to Z, be sure to check out our complete guide.

You can also learn how to use WordPress with our free online course.

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.