Google AdSense Code Example: Your Site Needs It, YouTube Doesn't
Copy-ready Google AdSense code examples for your blog or archive site, why YouTube needs none, and how the $100 payout, W-9 and 1099 rules work.
A Google AdSense code example has two parts. The first is one loader script that goes between <head> and </head> on every page. The second is an <ins> block plus a one-line push script for each ad you place inside <body>. Both are below, explained line by line. If your income comes from YouTube, there’s no code to paste at all.
Payday snapshot
- Threshold to get paid: On YouTube you need 1,000 subscribers plus either 4,000 public watch hours in the last 12 months or 10 million Shorts views in the last 90 days, and a linked AdSense for YouTube account. On your own website you need to be 18 or older, publish original content and pass Google’s site review. Website AdSense pays out once your balance hits $100.
- Typical earnings range: Google publishes no RPM (revenue per 1,000 views) figures. On websites you keep 80% of ad revenue after the advertiser platform’s fee. When ads are bought through Google Ads, that works out to roughly 68% overall. Earnings vary heavily by niche and by where your audience lives.
- Time to first payout: Site review usually takes a few days but can take 2 to 4 weeks. Once your balance clears $100, website AdSense pays between the 21st and 26th of the following month. On a small site, reaching $100 can take a long time.
YouTube: No Code, Just Thresholds
On YouTube, ad money runs through the YouTube Partner Program (YPP). According to YouTube’s YPP overview, there are two ways to qualify for ad revenue, and both need 1,000 subscribers:
- 4,000 qualified public watch hours in the last 12 months (long-form)
- 10 million qualified Shorts views in the last 90 days
Watch hours from Shorts viewed in the Shorts Feed don’t count toward the 4,000 hours. If Shorts is your main format, our YouTube Shorts money guide walks through that route.
Once you qualify, you accept the base YPP terms and link one active AdSense for YouTube account as part of your application. If you don’t have one, YouTube says YouTube Studio is the only place to create it.
To receive ad revenue you must be 18, or have a legal guardian over 18 who handles payments through AdSense for YouTube. After you’re monetized, you share in revenue from ads served on the Watch Page and in the Shorts Feed. For what channels actually earn, see how much YouTubers make.
The payment calendar and tax rules further down come from Google’s website AdSense pages. Google doesn’t clearly say they’re identical for AdSense for YouTube, so check the payments section of your linked account.
Platform Requirements, Side by Side
| YouTube channel | Your website or blog | |
|---|---|---|
| Code to paste | None | Loader in <head> on every page, ad units inside <body> |
| Audience bar | 1,000 subs + 4,000 hours (12 mo) or 10M Shorts views (90 days) | No follower count: “high-quality, original” content that attracts an audience |
| Age | 18+, or a guardian over 18 handles payments | 18+, or a parent or guardian applies with their own Google Account |
| Account | AdSense for YouTube, created in YouTube Studio | Standard AdSense, plus a site review |
| Access needed | Your channel | Ability to edit the site’s HTML |
The One Line Every Page Needs
AdSense has two kinds of code. The AdSense code (the loader) covers your whole site and is all you need for Auto ads. Ad unit code is the loader plus a separate block for each individual ad.
To get the loader, go to Ads → Get code → Copy code snippet. Paste it between <head> and </head>. Google recommends putting it on every page. Here is Google’s published sample:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456" crossorigin="anonymous"></script>
asynclets the page keep loading while the ad script downloads.?client=ca-pub-...is your publisher ID. The one above is Google’s placeholder and earns nothing, so always paste the code from your own account.crossorigin="anonymous"is part of Google’s current snippet. Some GitHub gists leave it out, so copy the code from your account, not from a gist.
On WordPress, a header plugin such as WPCode adds the loader to every page without editing theme files. If you’re still building that site, start with our guide to starting a blog alongside your YouTube channel.
A Responsive Display Ad, Line by Line
For a single placed ad, go to Ads → By ad unit, hover over the unit and click Get code. Here’s Google’s responsive example, with line breaks added:
<ins class="adsbygoogle"
style="display:block;"
data-ad-client="ca-pub-1234567890123456"
data-ad-slot="5678"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456" crossorigin="anonymous"></script>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
<ins>is the empty box where the ad appears.data-ad-clientis your publisher ID, the same on every ad.data-ad-slotidentifies this particular unit.data-ad-format="auto"sizes the ad automatically. On desktop you can switch it to"rectangle","vertical"or"horizontal", or combine them, such as"rectangle, horizontal".data-full-width-responsive="true"is the setting Google says has “the greatest revenue potential.” Setting it to"false"may lower earnings..push({})tells the AdSense script to fill this slot.
If the loader is already in your <head>, each extra ad only needs its own <ins> block and push line. Ad unit code must go inside <body>, because Google says code outside it stops ads appearing correctly. To position an ad, wrap it in normal HTML such as <div align="center">.
Other Formats Worth Knowing
- In-article: uses
data-ad-layout="in-article"anddata-ad-format="fluid". Google suggests placing it about two paragraphs below the start of a post. It goes full width on phones held upright. - In-feed: for post lists and episode archives. Place it inside the feed, between items or at the start or end. The minimum width is 250px, and the parent container needs an explicit width but no fixed height. To repeat it, use a counter in your template’s feed loop.
- Multiplex: uses
data-ad-format="autorelaxed". Google calls its row and column customization options “deprecated”: they may still work, but that isn’t guaranteed. Since June 2026, each ad in a Multiplex grid counts as its own ad request.
Getting Your Site Approved
You can connect a site in three ways: the loader snippet, an ads.txt line or a meta tag. The meta tag suits you if you don’t want the snippet on your homepage:
<meta name="google-adsense-account" content="ca-pub-0000000000000000">
Add an ads.txt file at yoursite.com/ads.txt as well. Google calls it “not mandatory, but highly recommended”:
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
Swap in your own publisher ID in both. The AdSense crawler must be able to reach your site without a password, and robots.txt must not block it. If you have visitors in the EEA, UK or Switzerland, you need a Google-certified consent tool (a CMP) to serve personalized ads to them.
What Creators Wish They’d Known
You can’t put AdSense in newsletter emails. Google’s code modification policy bans ads in emails and software, so put ads on your web archive instead. Our breakdown of whether a newsletter can make money covers the income streams that do work in the inbox.
Clicking your own live ads to “test” them counts as invalid traffic. If Google sees high levels of it, it may suspend or close your account.
You’re allowed to size ads with CSS and media queries, run A/B tests, set custom channels dynamically and minify the tag. You’re not allowed to hide ads (except when building a responsive unit), let ads and content cover each other, add sliding or zooming effects, or trigger clicks when users drag on mobile.
Placement rules:
- Ad labels can only say “Advertisements” or “Sponsored Links.”
- No asking for clicks or rewarding them.
- No auto-refreshing ads, and no ads that open in a new window.
- Google won’t serve ads on sites with more than three pop-ups or any pop-unders.
Real Google email shows “@google.com” in both the From address and the Return-Path. Google won’t send unsolicited requests for your password.
How the Money Lands (US Edition)
For website AdSense, Google’s payment thresholds work in steps. You submit tax info and verify your identity before ads show. At $10, Google mails a PIN to verify your address and you can choose a payment method. At $100, you get paid.
Last month’s earnings are finalized on the 3rd. If your balance is at the threshold by the 20th, payment goes out between the 21st and 26th. US accounts are paid by EFT (up to 7 business days to arrive) or PayPal Hyperwallet. Checks and wire transfers aren’t available.
Google’s revenue share page says the 80% publisher share is the same in every country. Your actual earnings still vary widely by niche and audience country.
On taxes, US publishers file a W-9. Google’s general supplier page says it may apply backup withholding at 24% (or chapter 3 withholding at 30%) without valid tax forms. Google’s AdSense page still says a 1099-NEC is issued at $600. The IRS’s 1099 instructions are more authoritative and raise the threshold to $2,000 for tax years beginning after 2025, so $2,000 applies to 2026 payments. Forms arrive by the end of January. Not getting one doesn’t change what you owe, so keep your own records. We’re not tax advisors, and this isn’t tax advice, so check your situation with a qualified professional.
Revenue Streams, Ranked
Keep platform payouts, brand deals and affiliate income in separate buckets.
- Small audience: YouTube ads stay locked until you qualify for YPP. Affiliate links and UGC deals (brands pay you for content that runs on their channels) can pay sooner. Site AdSense starts as a trickle.
- Mid-size: sponsorships often overtake ad revenue. Our sponsorship playbook covers pitching. YPP ads add a base.
- Large: ads, sponsors and affiliates all matter, and your own site is an asset you control.
FAQ
Can I copy an AdSense code example from a tutorial?
Only to learn the structure. Sample IDs like ca-pub-1234567890123456 are placeholders. Copy your real code from your own account.
How many AdSense ads can I put on one page? Google’s current placement pages set no limit. The placement and click rules above still apply.
How long until ads show up? For Auto ads, Google says it can take up to an hour once the code is live and your site is approved.
Can I add AdSense to my YouTube channel description or videos? No. YouTube ads run only through YPP and your linked AdSense for YouTube account.
Will I get a 1099 from AdSense? US publishers get a 1099-NEC. Under IRS rules for 2026 payments, that happens once you’re paid $2,000 or more.
Your Next 30 Days
- Week 1: Check your YPP progress in YouTube Studio. If your blog or archive site is live, confirm you’re 18+ (or have a guardian ready to apply) and apply for AdSense.
- Week 2: Paste your own loader into
<head>on every page, add ads.txt, and confirm robots.txt doesn’t block Google’s crawler. - Week 3: Once approved, place one responsive unit and one in-article unit. Submit your W-9 and set up EFT or Hyperwallet.
- Week 4: See which pages earn, enter your address PIN when it arrives, and keep pitching sponsors and affiliate partners while ad revenue builds.
Creator FAQ
How many AdSense ads can I put on one page?
Google’s current placement policy pages don’t set a number. The old “three ads per page” rule isn’t on them anymore. The real limits are about behavior: no ads covering content, no more than three pop-ups on the site, no pop-unders and no auto-refresh. Too many ads can also hurt your readers’ experience, so add them gradually and watch your engagement.Is ads.txt actually required?
Google calls it “not mandatory, but highly recommended.” Without it, you may get less advertiser spend. After you add or change the file, it can take a few days to register, or up to a month on low-traffic sites. So set it up on day one.I pasted the code. Why are my ads still blank?
Usually it’s one of three things. Your site hasn’t been approved yet (review can take 2 to 4 weeks). You pasted Google’s sample publisher ID instead of your own. Or the ad unit code is outside the body tags. Auto ads can also take up to an hour to show after you turn them on.Can I monetize a podcast with AdSense?
Not inside the audio itself. AdSense is for web pages, so podcasters use it on show-notes or episode archive pages. In-feed units work well on episode lists. If your podcast is on YouTube, the ad money there comes through the YouTube Partner Program, not website code.Someone emailed saying they're from AdSense and need my login. Is it real?
Almost certainly not. Google doesn’t send unsolicited requests for passwords. Check that both the From address and the Return-Path show @google.com. If someone calls, ask them for your publisher ID or your ad unit names before you share anything. Report fake pages through Google’s Safe Browsing phishing form.