Adjet

How to Add Google AdSense to WordPress: The Complete 2026 Guide

You want AdSense running on your WordPress site, and you want a setup that still works after the next theme update. Here is the whole path, from account verification to reading the first numbers.

Adding Google AdSense to WordPress sounds like a five minute job: copy the code, paste it into the theme, done. In practice it is usually the start of a small, slow burning annoyance that only surfaces at the next update, when the ad code has quietly vanished and nobody noticed for a fortnight.

This guide walks the whole path: account verification, ads.txt, the decision between Auto ads and manual units, and how to get the code into WordPress in a way that does not need revisiting every time you touch the site.

What you need before you start

Before you put AdSense on a WordPress site, a few things should already be settled. First, a Google account and a website that meets the AdSense programme policies, which means original content, enough of it, and nothing that breaches the policies (checked 10 July 2026). Second, access to the code side of your site, or a plugin that handles that part for you. Third, some patience, because several days often pass between application and approval.

If you are also wondering how to serve ads in a privacy compliant way, meaning consent banners and cookie gating, that is its own subject and deserves its own care. This article stays deliberately on the technical integration rather than the legal side, and nothing here is legal advice.

Step 1: create the account and verify the site

Register at adsense.google.com with your website URL and your Google account. Google then checks two things: whether your content meets the policies, and whether you actually own the site. For verification you get a code snippet that has to sit in the <head> section of every page.

This is where the first problem starts for a lot of people. Where do you put that code so it does not disappear at the next update? The common answers:

  • header.php in the theme: works, and is gone the moment you update or switch your theme.
  • A site kit plugin: Google's own plugin connects your account and inserts the verification code for you.
  • An ad management plugin with site verification: holds the code centrally and survives a theme change.

After verification, Google reviews the site, which can take anywhere from a few hours to several days. You are not allowed to serve ads before approval comes through.

Step 2: getting ads.txt right

ads.txt is a small text file in the root directory of your domain that declares which providers are authorised to sell ad space on your site. Without it you potentially lose revenue, because some demand platforms will not bid at all when there is no valid ads.txt. AdSense shows you the exact line to add in your account, usually in this form:

google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0

The file has to be reachable at yourdomain.com/ads.txt, not in a subfolder. WordPress gives you two ways to get it there: upload the file to the root directory over FTP, or use a plugin that serves the file virtually, which is handy when you have no FTP access or several people work on the site. Check afterwards in a browser that the file really loads, because a 404 at that address costs you actual money. The details, including what each field in that line means, are in the ads.txt setup guide.

Auto ads or manual ad units?

AdSense offers two fundamentally different approaches, and the choice between them matters more than it first appears.

Auto ads lets Google decide where ads appear on your site. You embed one script, and an algorithm picks positions and formats based on your layout and its read of user behaviour. It is quick to set up and generally a decent starting point, but you hand over control of placement. Ads sometimes land in spots that make little editorial sense or get in the way of reading.

Manual ad units give you full control: you create a publisher and slot ID per unit and place it deliberately, after the third paragraph or in the sidebar. That takes more setup, and it pays off as soon as you want to test which position actually works.

In practice a mixture usually makes the most sense: Auto ads for the broad coverage, plus a few manual units in the places you want to control on purpose, such as above the fold or at the end of an article.

The three integration routes, honestly compared

Once you know whether you want Auto ads, manual units or both, the question is how the code gets into WordPress. There are essentially three routes, and none of them is wrong as such. They simply fit different situations.

RouteSurvives a theme changePlacement controlBest for
Code in the themeNo, an update or theme switch removes itManual, one edit per positionA single quick test
Google Site KitYesBasic, placement is not its focusAccount connection and combined Google reporting
Dedicated ad management pluginYesFull, per position and per deviceMore than one ad unit, or testing placements

Code straight into the theme

You copy the AdSense code into header.php, footer.php or a child theme. It is the fastest route and fine for a one off test. The problem shows up later: switch themes, or let an update overwrite your changes, and the code is gone, usually noticed only when the revenue drops. If you want an ad in several places in different formats, you also end up editing several spots in the code. For a permanent setup it is rarely the best option.

Google Site Kit

Site Kit is Google's official plugin and brings AdSense, Search Console and Analytics into one interface. For connecting the account and handling verification it is a solid, official starting point, and if you want to read several Google services together it earns its place. When it comes to fine grained placement, meaning exactly which ad appears where in the content with which targeting, Site Kit is deliberately restrained. That is not what it is for.

A dedicated ad management plugin

A plugin built specifically for managing ad units separates the ad code from the theme. You create units centrally, place them by shortcode, block or automatic rule, and the code stays untouched through theme changes and updates. The extra effort over copy and paste is small, and the maintenance benefit is large as soon as more than one ad is involved.

That third route is what we built Adjet for, a free ad management plugin with its own AdSense wizard. You enter your publisher and slot ID and get a finished, responsive ad unit without assembling the code yourself. Placement, targeting and statistics then all live in the same interface. How to put formats and positions against each other systematically is covered in split testing ads in WordPress. It is the most comfortable route we know, and it is not automatically right for every site: if you already work with Site Kit and need one single Auto ads surface, that setup serves you just as well. Adjet Free is on wordpress.org, and what the Pro version and our other plugins cost is on the pricing page.

From experience: whichever route you pick, open the site in a private window afterwards and check that ads really appear. Some ad blockers and consent tools hide test ads, which is easy to mistake for a broken setup.

Placing ads with some restraint

How many ads you show and where has a strong effect on whether readers stay. A few ground rules that hold up in practice:

  • Go easy above the fold: a large ad that loads before any content is visible feels pushy and costs more in user experience than it brings in revenue.
  • In content beats the edges: ads inside the reading flow, after the third paragraph for instance, frequently outperform pure sidebar placements that many readers have learned to ignore.
  • Do not overload the page: three well placed ads beat eight scattered ones almost every time, on click through rate and on reading experience alike.
  • Think about mobile separately: what looks discreet on a desktop can take up half a phone screen. Test placements for mobile and desktop on their own.

An ad plugin with device targeting helps directly here, because you can switch a unit on for desktop only or mobile only instead of building one compromise for every screen size.

Reading the first numbers

After a week or two, the first look at the data is worth it. The key figures are impressions, meaning how often an ad was shown at all, the click through rate, and average earnings per thousand impressions. If one position swings sharply downwards, check whether it sits too far down the page or is frequently hidden by an ad blocker. For a sense of what those numbers tend to look like in reality, we collected them in how much AdSense actually pays.

With an ad management plugin that has its own statistics, you see these values directly in the WordPress admin without switching tools. Adjet shows a 30 day chart of impressions and clicks per ad unit, stored entirely in your own database, with no external calls back to us. That makes it quick to see which placement earns its space and which one you are better off switching off, instead of guessing.

Keep in mind that AdSense itself provides an extensive dashboard with reports by ad unit, country and device. The local statistics in a plugin do not replace that. They add a fast overview in the place where you manage the ads anyway.

The usual traps

A handful of mistakes keep coming up when AdSense goes into WordPress:

  • Verification code gone after an update: the classic result of putting code in the theme instead of in something that survives updates.
  • ads.txt missing or in the wrong directory: leads to lower bids without ever announcing itself.
  • Too many changes tested at once: change five positions in one go and you cannot tell afterwards which change did anything.
  • Ads loading before consent: a privacy matter that deserves its own attention, since AdSense serves personalised advertising with cookies by default.

If you already run another ad plugin and are thinking about a change, our honest comparisons are in the Ad Inserter alternative and the Advanced Ads alternative.

Conclusion

Getting Google AdSense into WordPress is not technically difficult, but it pays to choose an integration from the start that outlives a theme update. Verify your site, set up ads.txt properly, decide deliberately between Auto ads and manual units, and place ads with your readers in mind rather than maximum surface area. Whether you write the code into the theme, use Site Kit or run a dedicated plugin such as Adjet matters less than making that choice on purpose instead of under time pressure.

Set up AdSense without writing code

The AdSense wizard in Adjet walks you through the integration, keeps placement in one place and shows clicks and impressions locally, with no external calls.

See Adjet

Frequently asked questions about AdSense in WordPress

How long does AdSense approval take?

AdSense approval usually takes between one day and two weeks after you have registered and verified your website. Google checks two things in that time: the technical verification through the code snippet in the head section, and whether your content meets the programme policies. On new sites with thin content the review can take longer or end in a rejection, which you can resubmit after improving the site. Either way, you are not allowed to serve ads before approval comes through.

How many ads per page make sense?

There is no fixed number, but three to four well placed ad units are a sensible range for most blog articles. More ads do not automatically mean more revenue, and the click through rate often falls when readers find a page overloaded. In content placements inside the reading flow, after the third paragraph for example, frequently perform better than pure sidebar advertising. Above the fold you should stay restrained, because a large ad loading before any content feels pushy and costs more in user experience than it earns.

Do I really need a plugin for AdSense?

No, a plugin is not strictly necessary, and you can paste the AdSense code into the theme by hand, for example into header.php. The problem tends to appear later: switch themes or let an update overwrite your changes and the code is gone, often unnoticed until the revenue drops. A plugin such as Adjet or Google Site Kit becomes worthwhile as soon as you want to manage more than one ad, test placements or stay independent of theme updates.

What is the difference between Auto ads and manual ad units?

With Auto ads a Google algorithm decides where and in which format ads appear on your site, and you only embed one script for it. With manual ad units you create a publisher and slot ID per unit yourself and place it deliberately, after the third paragraph or in the sidebar. Auto ads is faster to set up but hands over control of placement. In practice a mixture of both usually makes the most sense.

Do I need to combine AdSense with a consent banner?

As a rule yes, because AdSense serves personalised advertising with cookies by default, and under data protection law that needs prior consent. AdSense running before consent has been given is one of the most common traps in the whole setup. This is an orientation rather than legal advice, and the specifics depend on your market and your setup, so check yours with someone qualified. This article deliberately stays on the technical integration rather than the legal side.

Back to blog A post by hafenstudios