How to Add Google AdSense to Your WordPress Website

How to Add Google AdSense to Your WordPress WebsiteNo one likes ads, but the truth is that these bring money to content creators. You have bills to pay, and it makes sense to add Google AdSense to your WordPress website.

Ads are a simple and effective manner to monetize your site. The biggest issue is to find the perfect balance between the number of ads and the user experience. Too many ads hurt the user experience, while too few ads won’t generate enough revenue.

Roll up your sleeves and carefully read this article to learn how to add Google AdSense to your WordPress website

Google AdSense for WordPress – pros & cons

Google AdSense homepage

Google AdSense is a program that allows publishers to get paid by displaying ads. Marketers pay Google to post their ads on sites relevant to users. Publishers get a fraction of the marketer’s payment when displaying an ad on a blog. Google AdSense is the intermediate party, streamlining the partnership between marketer and publisher. Its major advantage is the time saved for both marketers and publishers.

Google AdSense is the leading program in this space for many reasons. First, it’s Google’s group of experts working on this program. As a result, the ads are relevant and in line with the publisher’s style. Second, the requirements to join the network are simple and clear. You have to be 18 years old or above and publish unique content on your blog, which must be user-friendly. Third, it’s easy and free to create an AdSense account.

With that said, Google AdSense is far from perfect. The low payment rates and the unexpected closing of accounts are two major disadvantages of Google AdSense.

Create a Google AdSense Account

Go to the Google AdSense page and sign up to create an account. Add your site URL and email address. Additionally, you can sign up for the AdSense mailing list. It will take Google from a few hours to two weeks to review your site. Bear in mind that AdSense may reject sites even though they don’t violate their terms and conditions. Brand-new sites with little content are usually rejected. Don’t take it too hard; it’s normal because Google can’t know whether your intentions are good. Keep adding content, and then request a new review.

Google Ads comes with three types of ad units:

  • Display – these ads work smoothly everywhere, and you have plenty of templates to select from.
  • In-feed – these ads are placed within lists of articles; the ads look natural, but readers can easily distinguish them from the articles.
  • In-article – these ads are placed within articles.

Google AdSense types display ads

You have to place a code on your site to connect AdSense to your site. Google recommends placing the code in your index file, between <head> and </head> tags. There are three solutions to do this:

Follow Google recommendations.

Simply go to your site and place that code, then check if you inserted it correctly. This approach works for static websites, but it’s not feasible for WordPress sites. The code disappears when the theme is updated, so you have to place the code again and again.

Use a child theme.

It saves a lot of headaches, so a child theme is a good alternative. A child theme isn’t just a solution for placing the AdSense code, but also for customizing the theme without losing your work when the theme is updated.

Use a plugin.

Someone said that there is a plugin for every WordPress issue, and I couldn’t agree more with this. Site Kit is Google’s WordPress plugin that allows you to get information from Search Console, Analytics, PageSpeed Insights, and AdSense in a single dashboard.

Google Site Kit

Use this plugin to connect the AdSense account with your site. You don’t need coding skills; the average WordPress user can set up the plugin hassle-free. Insert Headers and Footers is a solid alternative to Site Kit. Install, activate the plugin and place the AdSense code to go to the next step.

Adsense WordPress – Create Ad Units

Once Google gives you the green light, start creating ads for your site. Practically, you have to place the ad code generated automatically by AdSense on your site. There are two alternatives to create an ad unit for your site.

Auto-generated ads

Google AdSense auto generated ads

If you are new to the space of advertising, you could delegate Google AdSense to take care of the ads on your site. Go to your AdSense account > Ads > Overview > By Site and click on Get code. It will display a code that you place on every page and post in which you want to display ads. Google will analyze the webpage profile and will display the suitable ads. You don’t have to worry about the ad size and position, which is great for newbies and bloggers who don’t have time. Webmasters who want full control over ad management may not appreciate this approach, however.

Manually generated ads

This way of generating ads for your site is a little more complicated, but you have more control over the types of ads. Go to the Google AdSense page and chose one of the three types of ads: display, in-feed, or in-article.

  • Display ads are the simplest to configure. Just click on the Display ads icon and it redirects you to the customization page. Here you select the type of the ad – square, horizontal, or vertical. Additionally, you can choose between responsive and fixed formats. Double-check how your site looks on mobile devices if you go for the latter option. A fixed ad risks affecting the webpage layout and frustrating some of your readers.
  • In-feed ads look great on mobile and are simple to customize. Either let Google create an in-feed ad after it scans the webpage, or you can do it by yourself.
  • In-article ads come with more style options. You select the font, title, description, and background color. Do you believe that Google has better font and color choices? No problem, you just have to tick a checkbox, and Google will do its best to optimize the font and the colors used.

Insert Adsense Ad Units to WordPress Site

At this step, you already have a complete ad management strategy. You either let Google AdSense take care of the ads or you crafted a few ad units.

Either way, placing the code manually on each webpage is annoying and takes time. Besides, the ad code might disappear when you update the theme, depending on where you placed the ads. Again, the Insert Headers and Footers plugin is what you need. It’s worth mentioning that Google AdSense endorses this plugin, developed by WP Beginner.

Auto-generated ads are simple to insert. Install and activate the Insert Headers and Footers plugin, and then paste the ad code from Google AdSense into the header. From now on, your site will display ads based on the Google algorithm.

Webmasters who prefer more control over the ads have more work to do. Altogether, it’s not too complicated, and over time you will master this task. Thankfully, a bunch of effective plugins to manage the AdSense ad units is available in the WordPress repository. Besides that, you can also paste the ad code within a custom HTML widget. Here is how to place an ad unit code using either a plugin or manual entry.

Insert Ad Units With a Plugin

Choosing the proper plugin for ad management depends on your needs and expectations. The good news is that developers have created many plugins for this purpose. Google endorses the following two plugins for managing the ads on your site; let’s take a look at them.

Advanced Ads has 100,000+ active installs and a 4.9 out of 5 stars rating, which is a pretty clear indicator that this plugin deserves a look. The version from the WordPress repository is free of charge but has limitations. The premium version includes many more features.

This plugin allows inserting unlimited ads on your site without writing a single line of code. You set the starting and expiration times for each ad. It also lets you target users based on their geographical location. You can also insert ads after a set number of paragraphs or words, and trigger them based on the user’s activity.

Ad Inserter is another first-class plugin for ad management. It has the same excellent rating, and double the number of active installs as Advanced Ads in the WordPress repository. Similarly, it has both free and paid versions. Ad Inserter users can insert unlimited ads on selected pages, while having control over the placement. The ads inserted with this plugin don’t affect the webpage layout, so you can keep the Cumulative Layout Shift indicator, a new Google ranking factor, under control.

Insert Ad Units Manually

You can also insert ad code through widgets. Go to your WordPress admin dashboard and click on Appearance > Widgets. Select a custom HTML widget, paste the code of the ad unit you want to insert, and select the ad placement – on the sidebar, header, or footer.

Google AdSense for WordPress Best Practices

Installing AdSense on your WordPress site is the first step in your quest to monetize the site. However, professional ad management isn’t a fire-and-forget activity. Of course, you can place ads on your site and forget about them, but you may be leaving significant profits on the table. Sometimes, a small design tweak may boost the number of clicks on an ad.

Briefly, it’s not enough just to place ads – how and where you insert them is crucial. The following best practices help you get the most from the Google AdSense program.

Test, test, test

Your site audience is unique. No expert can develop a strategy for ad management without having a complete picture of your site’s audience. Testing is your best friend in managing the ads. Most plugins include the A/B testing option, so you don’t need complex tools to perform tests. Adjust the layout of your ads, the number of ads, their position, etc.

Use a Plugin

A plugin streamlines the insertion of the ads. If you choose to place only a few ads on the homepage, a plugin is redundant – you can do it manually. Conversely, an ad management plugin is golden if you want to maximize your revenue through AdSense. Most plugins allow testing and provide valuable feedback, so you have precious help to refine ad placements.

Check the Ad Performance

google adsense reports

The same as you check Google Analytics and Search Console to find out your site performance, you should visit the Reports section to evaluate the performance of the ads. There is a lot of precious data available about the best-performing ads, the estimated earnings, user behavior, and location. Analyze this data to serve your audience better.

Less Can Be More

People understand that the ads are what pay your bills. Site visitors will click them if they are relevant. However, adding too many ads on a webpage hurts the user experience. More ads aren’t equivalent to more revenue generated. It’s an art to find the ideal ad number, format, and placement while letting the user consume the content effortlessly. Too many ads are a sign of amateurish work, and they will make people leave your site instantly.

High-quality Content

It’s a no-brainer tip, but it’s the most significant factor in attracting people to the site. No visitors came to your site to enjoy the ads displayed; they visit your site to consume your content. The quality of your writing is the only attraction and you don’t have any solution but to keep high standards.

Optimize for Mobile

Let’s be honest, everyone talks about mobile optimization! Considering the number of articles related to mobile optimization, you would think that all sites are mobile-friendly! The reality is different – plenty of websites aren’t mobile-friendly and the ads are one of the culprits. Webmasters take some important steps in this direction, but websites are far from achieving complete mobile friendliness.

Do everything possible to make your site mobile-friendly, but accept that it won’t be perfect. Check the ads on your site by using a mobile device. Make sure that the ads are responsive. Bear in mind that some people use low-speed connections. Testing and optimizing for mobile goes hand in hand.

Fast Forward

It may seem pretty challenging to add Google AdSense to your WordPress website. However, you will manage to do it by following the below simplified algorithm. Here is a recap to help you monetize your site faster:

  • Go to Google AdSense and create an account.
  • Copy the code from AdSense and paste it to your site. Recommendation: use Site Kit, the plugin released by Google to connect more accounts – Analytics, Search Console, PageSpeed Insights, and AdSense.
  • Place ads on your site once Google approves your request. Copy the ad code and place it on your site. Use a plugin if you expect to earn serious money from your AdSense account. Place the ads manually if you just want to test the waters.
  • Let Google place the ads automatically if you don’t have enough expertise or time.

Adsense for WordPress – Wrapping Up

Google AdSense may be a solid source of income for your site. There’s no shame in displaying ads on your site, as long as you publish quality content. More and more people understand that creating good content is a huge endeavor and publishers need to be recompensed for their work.

As you noticed, adding Google AdSense to your WordPress site isn’t rocket science. Google AdSense isn’t the most profitable platform for publishers. Still, it has plenty of positive aspects, so you should give it a try.

 This post was written by Mesheal Fegor

Mesheal Fegor is a Web/WordPress Developer and technical writer. His WordPress help articles have been featured on Kinsta and other sites. Mesheal holds a master's degree in computer science. His writing focuses on technical WordPress issues, ranging from core WordPress problems, to issues with WooCommerce, and more.

Last edited by: FixRunner Team