ads.txt for WordPress­ – ­Ultimate Guide for AdSense & co

If you are a publisher using some kind of ad network on your website, then you probably heard about the ads.txt file already. This ultimate guide is for you whether you want to set-up-and-forget or to understand the details about ads.txt files. While I am going to give examples related to ads.txt AdSense code and ads.txt on WordPress sites, most of the information applies to other ad networks and CMSs.

In a nutshell

No time to read everything? These are the most important things you need to know about the ads.txt:

  • it is a standard introduced by the IAB to reduce ad fraud.
  • The content of this file verifies that an ad network is allowed to sell ads on your site.
  • There is only one ads.txt file. It can contain multiple lines of information from various partners, though.
  • The ads.txt is not mandatory, but some networks already request it. It might become necessary in the future.
  • Not having an ads.txt might decrease your revenue from ads because advertisers might only buy ads on sites that verified an ad network.

With Advanced Ads it takes only a few seconds to automatically create your ads.txt file and integrate it into your website.

What is the ads.txt?

The ads.txt file is based on a standard introduced by the IAB Tech Lab, a non-profit organization that focuses on technology and standards in the digital media industry. Members like Google, Yahoo, or Microsoft make it quite powerful when it comes to bringing forward technologies that shape the world wide web.

The problem that these organizations wanted to solve is enormous, and the solution rather simple. Each year, billions of US dollars are spent on online advertisements that no real human interacts with. While bot traffic is one cause of the problem, the other is that some dubious ad networks bill advertisers for ad impressions on websites where the ad was never displayed.

The ads.txt file should allow advertisers to check if a specific publisher allowed a media agency to sell ad space, also called digital inventory, on their site. Practically, they would just open the ads.txt file and check if the media agency is listed there.

Ads.txt Example
ads.txt example

Fun fact: the “ads” in “ads.txt” stands for Authorized Digital Sellers. So it does indeed not list individual ads or campaigns, but the companies allowed to sell ad space.

Even though this standard is not mandatory for publishers, ad networks are pushing it forward, because the full power in this standard lies in its broad adoption.

Isn’t it just a file?

You got me. While one can dive very deeply into explaining the history of the ads.txt standard and what it stands for, it comes down to just being a file that mostly sits quietly in the root directory of your website. So when your domain is, the ads.txt is accessible under

The very basic workflow is that you will be contacted by a company that wants to or already sells ad space on your website. They will tell you exactly what you need to add to your ads.txt file. When you know them and agree that they can sell ads on your site then you just put that information into the file and all should be fine.

Ads.txt AdSense code warning
You will see this warning in your AdSense account if the ads.txt AdSense code is missing on your website

How do I create the ads.txt?

You have two options to create the ads.txt file on WordPress. Either do it manually or use a plugin.

Using our Advanced Ads plugin, you can manage the content of your ads.txt file without editing any code. It even adds the correct ads.txt AdSense code automatically.

  1. Install and activate Advanced Ads as described here
  2. Go to Advanced Ads > Settings > General > Ads.txt and enter the content of the file
  3. Save the settings
  4. if Advanced Ads recognizes a third-party ads.txt, it offers you to import the entries and replace the file
  5. Check the result under

You can find detailed instructions and further information about this feature in the ads.txt manual.

Video: 1:20min
Click on the preview image to load and start the video from YouTube. By clicking you agree that your information will be sent to and processed by YouTube, LLC, 901 Cherry Avenue, San Bruno, CA 94066, USA. Read more

What does the ads.txt contain?

The ads.txt is indeed just a simple text file that contains a list of accounts authorized to sell ad inventory on a website.

As I already mentioned, your ad partners will send you the content that goes into the ads.txt file. I have seen that many times now, and it was never complicated. There are different types of entries, depending on who is the owner of the account used to monetize the inventory.

  • accounts owned by the domain owner (= you), e.g., Google AdSense
  • networks and partners who use their account to sell ads on your behalf on your domain, e.g., The Moneytizer
  • content syndication networks – that is a whole topic for itself

Read this if you like technical facts

The ads.txt goes into the root domain, not a subdomain. If your website is installed in a subdomain (e.g., or subdirectory (e.g.,, then the ads.txt would still need to be placed under

This has implications for WordPress networks that use subdomains or subdirectories. Only a single ads.txt would be needed for all of those sites containing all the information that is relevant to at least one of them.

You want more?

  • the ads.txt does not need to be a file but must be accessible for a browser or crawler like one
  • use Content-Type: text/plain; charset=utf-8 encoding in the HTTP header
  • HTTPS should be preferred over HTTP, but both are fine if they deliver a 2xx status

Format of ads.txt entries

The file contains one record per ad account.

There are three types of records:

  • Data records – the most common form
  • Variable declaration records – a new format
  • Comments – start with # in front of the line and are ignored

Data records

Data records each consist of 4 entries, separated by commas. So a typical entry looks like this:

AdvertiserDomain, PublisherAccountID, AccountType, CertificationAuthorityID

While the first three entries are required, the Certification Authority ID is optional. You shouldn’t worry if your ad partner doesn’t provide it.

A note on the AdvertiserDomain: This is the domain hosting the ad account, not your own domain.

Example of an ads.txt for AdSense

Let’s take a look at an example of the ads.txt AdSense code for a normal AdSense account:, pub-0000000000000000, DIRECT, f08c47fec0942fa0Code language: CSS (css)

You can copy the example from above and only need to replace pub-0000000000000000 with your own publisher ID to get the valid record for your ads.txt. Advanced Ads does create it automatically in the correct format if you connected Advanced Ads to your AdSense account.

Type of Account

The third entry in the ads.txt record contains the relationship between the ad partner and you. There are only two options: DIRECT and RESELLER.

  • DIRECT means that you, the publisher, are the account owner.
  • RESELLER means that the account owner is a third party that was authorized by you to monetize your site.

For your next geek-dinner

If you want to explicitly let the world know that you didn’t authorize any ad seller, you should create an ads.txt file with the following placeholder content., placeholder, DIRECT, placeholderCode language: CSS (css)

An empty ads.txt might return an error and leave your choice unclear.

Whitespace and tabs are ignored but should not be used within values. If fields contain tabs, commas, or whitespace, they are escaped with URL encoding. If this is done by mistake (i.e., you didn’t intend to use whitespace), then it could lead to the whole file being ignored.

Variable declaration records

A record in the ads.txt can consist of a variable and its value. It basically looks like this:


While VARIABLE is a string without any whitespace, VALUE can contain anything. For better readability (for humans), these entries go to the end of the ads.txt. Technically, they can go anywhere as long as they are in their own line. You can also specify the same variable multiple times. The reading bot should consider all of them.

The list of variables is defined. At the moment, there are only two:

  • CONTACT – human-readable contact information. E.g., name, email, and phone number number of “your ad guy”.
  • SUBDOMAIN – URL of a subdomain where an ads.txt that belongs to that subdomain can be found.

I can say from experience that the SUBDOMAIN variable is widely ignored. We intended to use it with our ads.txt feature but had to learn that AdSense and others do not interpret an ads.txt file on subdomains, yet.

Example of an ads.txt file

I tried to create an example of an ads.txt file with all the information above. I have seen much longer ones in real life, depending on the number of ad networks running on a site.

# this is an example for a comment, 12345, DIRECT, a93idljl9b, 32121, RESELLER, f496211, 123ABC, DIRECT
SUBDOMAIN=blog.example.comCode language: PHP (php)

The example above means that you would need to have an ads.txt for as well with the information relevant to that subdomain.

Who is reading this file?

Technically, a few bots should come around and check your ads.txt regularly. I tracked these bots on a small blog for a few days and found that my file was read 2-5 times per day.

It is part of the IAB Tech standard that your ad partners read your ads.txt to make sure that all entries are correct. They will probably also use bots for this, especially if they are larger networks like Google AdSense.

There is no central organization that checks your ads.txt regularly, which means that every network and ad partner might build their own bot and parser to “understand” your ads.txt. If they follow the IAB Tech standards then they should all get the same result from the same file.

The IAB Tech standard states that bots checking the ads.txt file should not come more often than every 7 days and cache the content of the file in their own system in the meantime.

The ads.txt is similar to the robots.txt file. It is voluntary for services to check and honor it. An ad network can still sell ad inventory from your site without your permission if they find an advertiser not checking the ads.txt file for it.

Using ads.txt on subdomains

According to the IAB Tech standard, publishers should always place an ads.txt on the root domain and not a subdomain. If you have different partners on a subdomain only, you need to place that information in a file that is available on the subdomain and link it from the main file using the SUBDOMAIN value. If the ad partners are allowed to sell inventory on the main domain and the subdomain then one ads.txt file is sufficient.

So far the theory. I received information from multiple ad networks that they don‘t support this, yet. You might not even find a monetization partner where you can register a subdomain for displaying ads only. When they have a manual onboarding process then these things are often agreed on a case-by-case basis, but they would still ask you to only have one ads.txt file in your root domain that includes their record

Based on this feedback, we built our ads.txt feature to work on root domains only so that you don’t risk any ad partner to not be verified on your site. You should not put the information of anyone into your ads.txt file if you don’t trust them to monetize your site responsively, subdomain, or not.


Starting in 2009, Thomas’ own word game website grew to 40 MM page impressions per month. He then built Advanced Ads to help his colleagues to place ads and test different ad positions and networks tests without any coding skills. Thomas now enjoys improving the product for our more than 150,000 users worldwide.

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.