- Dec 2026, 10:07 PM
How to Monetize a WordPress Site With Ads, Step by Step
To monetize a WordPress site with ads, you open a publisher account, add and verify your domain, then either paste one ad script into the site's footer or place...
To monetize a WordPress site with ads, you open a publisher account, add and verify your domain, then either paste one ad script into the site's footer or place a Direct Link behind a button or menu item. Every impression is sold in a live auction and you are credited the price the advertiser actually paid per 1,000 impressions; on Adstean advertisers bid from 1.00 CPM, with a floor of 0.10. Most of the work is on the WordPress side: where the code lives, what your cache does to it and how your consent banner treats it.
This guide is the hands-on part. If you are still choosing between ad networks, affiliate links and sponsorships, start with monetizing traffic without AdSense; if you want to understand CPM, CPC and CPA before committing, read how the main ad monetization models pay.
The seven steps, in the order that avoids rework
- Create the publisher account. It is free and self-serve.
- Add the site and pick a verification method. Enter the domain exactly as visitors reach it. If WordPress redirects
wwwto the bare domain (or the other way round), register the version that answers with a 200. - Verify ownership. Either upload a
.txtfile containing your token to the root of the domain, or put the token in a meta tag in the HTML of your home page. - Copy your code. You get one Direct Link per account (
adstean.com/entry?PID=followed by your ID) and one script that covers all seventeen formats through itsdata-formatattribute. - Install it in one place only. Pick one method from the table below.
- Clear every cache and test. Open the site in a private window, with no ad blocker, on desktop and on a phone.
- Leave it alone for a week. Read the daily earnings before changing anything.
Where to paste the script in WordPress
Four places work; they differ in what survives an update and how easy the code is to find later.
| Method | Advantage | Watch out for |
|---|---|---|
| A generic "insert headers and footers" plugin | No theme files touched; survives theme changes; one screen to edit | Use the footer field, not the header, so the script does not compete with your content for loading time |
| Custom HTML widget in a footer or sidebar area | Built into WordPress; easy to remove | Only loads on pages that show that widget area; many block themes have no classic widget areas at all |
| Custom HTML block in the block editor | Lets you test a format on a single post or page first | Applies only to that post; the Paragraph block or the classic visual editor will escape the code and print it as text |
wp_footer hook in a child theme | No extra plugin; version-controlled with the theme | Never edit the parent theme's functions.php: the next theme update overwrites it and the ads disappear silently |
In a block theme, the Site Editor lets you put a Custom HTML block in the footer template part, which acts as a site-wide footer widget.
The child theme option, with the exact code
If you already run a child theme, add this to its functions.php. Replace YOUR-ID with your publisher ID and choose the format you want:
add_action( 'wp_footer', function () { ?>
<script src="https://adstean.com/assets/ads/adstean.js"
data-publisher="YOUR-ID"
data-format="popunder"
data-cap-hours="12"></script>
<?php } );
data-cap-hours limits how often the same visitor sees the format (12 hours if you leave it out), and data-delay postpones its appearance. The cap is stored in the visitor's browser, so it applies per device. If the site uses the meta tag method for verification, the same pattern with wp_head instead of wp_footer prints the token in the page head.
Verifying the site on WordPress without surprises
The file method needs the .txt file at https://yourdomain.com/filename.txt. The WordPress media uploader cannot do this: it stores files under /wp-content/uploads/, not in the root. Use your hosting file manager or SFTP and drop the file next to wp-config.php. If its URL shows the WordPress 404 page, the file is in the wrong folder.
The meta method needs the tag in the HTML of the home page specifically. A header plugin or the wp_head hook both work. Check with "view source", not with the browser inspector, and remember that a page cache may keep serving the old home page without the tag until you purge it.
Where the Direct Link fits on a WordPress site
The Direct Link needs no script at all: every visit through it is auctioned on the server, which picks a campaign by country and device and applies frequency rules. Practical placements:
- A menu item. Appearance → Menus (or the Navigation block in a block theme) → Custom link. Give it an honest label.
- A button block in posts where readers already expect to leave the page, such as "continue" or download areas.
Because it is a paid link, mark it with rel="sponsored", as Google recommends for ad and paid links.
Which format goes in which slot of your theme
Choose by the space the theme actually has, not by the format that sounds most profitable. The full list is on the ad formats page.
| Theme slot | Format | Size |
|---|---|---|
| Desktop header below the logo | Leaderboard or Billboard | 728×90 or 970×250 |
| Sidebar | Wide Skyscraper or Half Page | 160×600 or 300×600 |
| Inside the article, after the second or third paragraph | Medium Rectangle or Large Rectangle | 300×250 or 336×280 |
| Mobile, top or bottom of the screen | Mobile banner | 320×50 or 320×100 |
| No slot available | PopUnder, PopUp, Interstitial, Vignette, Slider or Direct Link | Full page or overlay |
| Pages with a video player | Video Pre-roll | 640×360 |
Cache and JavaScript optimizers
Performance plugins and hosting-level optimizers often combine scripts into one bundle, add defer, or hold all JavaScript until the first scroll or tap. An ad script treated that way loads late, loads twice or never loads.
- Add
adstean.jsto the exclusion list for "combine", "minify", "delay JavaScript execution" and "load JS deferred". - Purge the page cache and any CDN cache right after inserting the code; otherwise visitors receive HTML saved before the change.
- Test with a throwaway query string (
?test=1) to bypass the cached copy, and compare with the normal URL.
Cookie consent in WordPress
If your site uses a consent banner, find out how it classifies third-party scripts. Many block scripts until the visitor accepts a category, so it may never run for visitors who ignore the banner. Decide deliberately which category it belongs to: the frequency cap writes to the browser's local storage, which privacy rules for the EEA and UK generally treat like cookies. Describe it in your cookie policy and, where your setup requires consent first, let the consent tool load the script after acceptance rather than hard-coding it.
ads.txt and mobile checks
ads.txt is a plain text file at the root of the domain, defined by the IAB Tech Lab, listing who is authorized to sell your inventory. WordPress does not create one by default. Two cautions: add only the exact lines each network gives you, and if an SEO or ads plugin generates a virtual ads.txt, do not also upload a physical file, because the server serves the physical one first and the plugin's lines vanish. See ads.txt, app-ads.txt and sellers.json for what buyers check.
On mobile, test on a real phone, not only in the browser's responsive mode. A 320×50 banner fixed to the bottom must not cover your cookie banner, the theme's back-to-top button or a sticky "buy" bar.
Mistakes that cost you a week
- Script pasted in two places (plugin and child theme): it runs twice and the same visitor gets two windows.
YOUR-IDleft as a placeholder: the tag loads but nothing is attributed to your account.- Code in a Paragraph block: it appears on the page as text and nothing runs.
- Verification file in the uploads folder: the URL returns your 404 page and verification fails.
- Changing format, frequency and position on the same day: you will not know which change moved the numbers.
Measure for one week before touching anything
Earnings are recorded per day, so a single afternoon tells you almost nothing. Compare the same weekdays, note daily traffic next to earnings and change one variable at a time. If one slot drops sharply while visits stay flat, the usual reason is that a campaign ran out of budget and stopped crediting, not a broken install. The publishers page walks through how each impression is credited.
Ready to set it up? Monetize your website with Adstean: add your WordPress site, verify it and paste your code.
Frequently asked questions
Is there a WordPress plugin for Adstean?
No. You add the script through any generic header and footer plugin, a Custom HTML widget or block, or the wp_footer hook in a child theme. The Direct Link needs no code at all.
Where is the best place to put an ad script in WordPress?
In the footer, loaded site-wide from one single place. That keeps content loading first and avoids duplicates.
Why do my ads not show after I installed the code?
Check, in this order: an ad blocker in your own browser, a page cache serving old HTML, a JavaScript optimizer delaying or combining the script, and a consent banner blocking it until acceptance.
Do I need ads.txt to monetize a WordPress site?
Only for the networks that ask you for a line. Put it in the domain root with exactly the lines you were given.
Can I test one format on a single post first?
Yes. Put the script in a Custom HTML block on that post, measure it for a week, then move it to the footer once you are happy with the format and frequency.
Buy traffic or monetize your website
From 1.00 CPM (minimum 0.10). Self-serve: start with 5 €, no monthly minimum. Free publisher account.
We'll send you the free PDF guide
“Monetize your website with popunder traffic”: pricing, install, common mistakes and how to earn more. No spam.
Expand the topic from the main network structure
Use these pages to keep exploring formats, advertisers, and publishers.
How to package publisher inventory so buyers understan...
Good inventory packaging makes the buying decision easier. Buyers move faster when the traffic sourc...
How to improve fill rate without damaging publisher qu...
Fill rate is the share of your ad requests that end in a paid ad. You raise it by giving more of you...
How to package ad inventory for faster buyer decisions
Good packaging shortens the time between interest and launch. Buyers act faster when the format, aud...



