How to Install Header and Footer AdSense Code in WordPress

How to Install Header and Footer Code for WordPress

The easiest way to earn your first penny when you start an online business is to put ads on your blog… And Google AdSense is an easy way to get started with ads.

If you’re not familiar with it, Google AdSense is a free service that lets you install advertising software and serve ads on your blog or website.

To make this happen, you simply cut and paste some code that you get from AdSense into a certain spot on your WordPress blog.

How to Install Header and Footer AdSense Code in WordPress

If you have a WordPress blog, this post will walk you through how to install the code you need on your WordPress blog.

Once the AdSense code is installed, Google AdSense will read the content of your blog posts and serve ads on your site that are relevant to your readers.

The more relevant the ads, the more likely your readers are to click on them.

Each time a reader clicks on an ad on your website, you earn some money.

If you haven’t already done so, the first step is to sign up for AdSense.

How to install header and footer AdSense code

Some custom WordPress themes allow you to add custom code without a plugin, but most do not.

For the rest of us, we will use a plugin. The easiest way to install the AdSense code in your header and footer on your WordPress site is to use a free WordPress plugin called “Install Headers and Footers“.

After you sign up for AdSense, follow these instructions to download and install the free plugin on your WordPress blog:

Step 1: Install the FREE “Insert Headers and Footers” plugin.

Hover over the “Plugins” link on the left-hand side of your WordPress dashboard.

Click “Add New”.

From the search bar on the Add New Plugins page, search for the “Insert Headers and Footers” plugin by WPBeginner.

Click “Install”.

Click “Activate”.

Step 2: Copy the AdSense Code from AdSense

This is an example of what the AdSense code will look like (highlighted) below. The code will start with <script and end in </script>:

<script async src=""></script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-123456789",
enable_page_level_ads: true

This is the head of your page.
<title>Example HTML page</title>
This is the body of your page.

To get this code from your AdSense account just log into AdSense and visit your Homepage.

  1. Sign in to your AdSense account.
  2. In the left navigation panel, click My ads.
  3. Click Auto ads.
  4. On the ‘Auto ads’ page, click Set up Auto ads.
  5. In the ‘Set up Auto ads on your site’ box, click Copy code.

If you don’t see it there, you can get the code from the “My Ads” menu option in the image below, just follow Step 1. and Step 2.

How to Set Up Auto Ads

Step 3: Add the AdSense Code to Your Header

Once you have copied the AdSense code, go back to your WordPress site.

Hover over the “Settings” link on the left-hand side of your WordPress dashboard.

Click “Insert Headers and Footers”.

Paste your AdSense code in the “Scripts in Header” section at the top of the page.

Click the blue “Save” button.

Now you have your AdSense code on all the pages where it needs to be.

You can now place ads in various places on your website.

Bonus Step 4: Reinvest Your Passive Income from AdSense with Acorns

Don’t need to spend your AdSense income and want to watch it grow?

Read this post for how to reinvest your AdSense income for free using the Acorns app. You can even set up an IRA for your AdSense income!