首页 / 博客与指南 / Technical & Code / ads.txt Explained for New AdSense Publis...
Technical & Code

ads.txt Explained for New AdSense Publishers: Setup, Syntax, and Timing [zh-hans]

作者: Rankzio Editorial Team • 发布于: September 19, 2026 • ⏱️ 5 min read
ads.txt Explained for New AdSense Publishers

What Is ads.txt and Why Does It Exist?

If you have spent any time in webmaster forums or publisher communities, you have almost certainly encountered discussions about ads.txt. Short for Authorized Digital Sellers, ads.txt is an industry-wide initiative established by the Interactive Advertising Bureau (IAB) Technology Laboratory. Its primary mission is simple yet vital: eliminating ad fraud, domain spoofing, and unauthorized inventory reselling across the programmatic advertising supply chain.

Before ads.txt was introduced, malicious actors could configure ad networks to sell ad impressions falsely claiming to originate from premium domains (e.g. nytimes.com) when the ads were actually displayed on arbitrary spam sites. Domain spoofing siphoned millions of dollars away from legitimate publishers. The ads.txt standard solves this by providing a public, cryptographically verifiable text file hosted at the root of a domain that declares precisely which advertising companies and seller account IDs are authorized to sell that website’s ad inventory.

The Biggest Misconception: Timing Your ads.txt Setup

One of the most persistent myths among beginner publishers is that you must upload an ads.txt file before submitting your website for initial Google AdSense approval. This misconception causes immense confusion and unnecessary frustration.

The Reality: You do NOT need an ads.txt file to apply for or receive initial website approval from Google AdSense.

During the initial application review, Google crawlers are evaluating your website’s content depth, navigational hierarchy, and legal policies. At this preliminary stage, you do not even have an approved AdSense Publisher ID (which begins with pub-xxxxxxxxxxxxxxxx). Creating an ads.txt file before you are approved is completely useless because you have no valid seller ID to declare!

Rankzio’s AdSense Readiness Checker inspects ads.txt purely as an informational check rather than a strict passing condition, ensuring applicants are not penalized prematurely.

When You MUST Implement ads.txt

While ads.txt is not required for application review, it becomes essential immediately after your AdSense account and domain are approved. Once approved, Google AdSense will display a prominent dashboard alert reading: "Earnings at risk - You need to fix some ads.txt file issues to avoid severe impact to your revenue."

If you do not create a valid ads.txt file after approval, programmatic advertisers buying through Google Authorized Buyers (formerly DoubleClick Ad Exchange) may refuse to bid on your ad slots, resulting in low ad fill rates, degraded eCPMs, and reduced ad revenue.

The Exact ads.txt Syntax for Google AdSense

An ads.txt file is a plain UTF-8 text document placed at the root level of your domain (accessible publicly at https://yourdomain.com/ads.txt). Each line inside the file declares an authorized seller and consists of four comma-separated fields:

# Domain Name, Publisher ID, Account Type, Certification Authority ID
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0

Deconstructing Each Parameter:

  • Field 1 (google.com): The canonical domain name of the advertising system. For Google AdSense, this is always google.com.
  • Field 2 (pub-0000000000000000): Your unique AdSense Publisher ID. You can locate this 16-digit identifier in your AdSense dashboard under Account > Settings > Account Information.
  • Field 3 (DIRECT or RESELLER): Declares whether you control the account directly or through an intermediary. For standard publishers who directly operate their own AdSense account, this is always DIRECT. If you work with an authorized monetization agency, they may instruct you to list RESELLER.
  • Field 4 (f08c47fec0942fa0): The certification authority ID assigned to Google by the Trustworthy Accountability Group (TAG). For Google, this hexadecimal identifier is always f08c47fec0942fa0.

How to Deploy ads.txt on Different Platforms

1. Deploying on Hostinger or Shared cPanel Hosting

  1. Log into your hosting control panel (e.g. Hostinger hPanel or cPanel).
  2. Open the File Manager and navigate to your public web root directory (typically public_html).
  3. Create a new file named exactly ads.txt (in lowercase).
  4. Paste your authorized line: google.com, pub-YOUR_ID_HERE, DIRECT, f08c47fec0942fa0 and save the file.
  5. Verify by visiting https://yourdomain.com/ads.txt in your web browser.

2. Deploying on WordPress

If you prefer not to touch server files directly, install a lightweight, dedicated plugin such as Ads.txt Manager. Navigate to Settings > Ads.txt inside your WordPress admin dashboard, paste your Google line into the editor box, and click Save Changes.

Common ads.txt Errors and Troubleshooting

  • Subdomain Placement: The ads.txt specification dictates that crawlers fetch ads.txt exclusively from the root domain (example.com/ads.txt). Do not place it only on a subdomain like blog.example.com/ads.txt.
  • Redirect to HTML: Ensure your server does not redirect /ads.txt to an HTML error page or 404 template. The HTTP response headers must deliver Content-Type: text/plain.
  • Formatting Spaces and Typographical Errors: Ensure there are no invisible special characters, curly quotes, or typos in your publisher ID. Use plain ASCII commas and spaces.
  • Crawler Disallow: Check your robots.txt file to confirm you have not inadvertently blocked crawlers from accessing /ads.txt.

Checking Your ads.txt Status with Rankzio

Whether you are auditing your site before application or ensuring your post-approval setup is error-free, Rankzio’s free AdSense Readiness Checker inspects your domain’s /ads.txt file and reports whether valid syntax is discovered. Check your site today to ensure smooth monetization!

📋 落地执行检查清单

  • ✔ Do not stress over ads.txt prior to receiving your initial approval
  • ✔ Retrieve your 16-digit publisher ID from the AdSense dashboard after approval
  • ✔ Format the entry: google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
  • ✔ Save file as plain text named ads.txt in your public_html root directory
  • ✔ Verify accessibility by loading https://yourdomain.com/ads.txt in browser
  • ✔ Confirm response header serves Content-Type: text/plain
  • ✔ Ensure robots.txt does not disallow the /ads.txt path

Test Your Website Against 21 AdSense Signals

Use Rankzio’s free AdSense Readiness Checker to inspect your crawlability, legal disclosures, and content depth in seconds.

Check My Website Free →

常见问题解答

No. An invalid or missing ads.txt file will not result in an account ban, but it will significantly lower your ad fill rate and revenue because premium advertisers will not bid on unverified inventory.

Google crawlers typically re-fetch ads.txt files every 24 to 48 hours. It can take up to a few days for the dashboard alert to clear.

Yes. If you work with other advertising partners (like Mediavine, Ezoic, or Monumetric), each network will provide their authorized lines to append to the same ads.txt file.

No. As detailed above, ads.txt is irrelevant to whether your content and website quality pass initial site approval.

Related Publishing Guides

How to Find and Check AdSense Code on Your Website
robots.txt and Crawler Access for Website Owners
Noindex Tags Explained Before You Apply for AdSense
← 返回所有文章