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 for AdSense and on WordPress sites, most of the information is applicable to other ad networks and CMSs.
Table of Contents
In a nutshell
No time to read everything? These are the most important things you need to know about ads.txt.
- Ads.txt 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.
- You can create a static ads.txt file in the root directory of your website installation or use a plugin like Advanced Ads to manage the content.
- There is only one ads.txt. 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 mandatory 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.
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 huge 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.
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 the ads.txt standard is not mandatory for publishers, ad networks are pushing it forward, because the whole 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 website is https://example.com, the ads.txt is accessible under https://example.com/ads.txt.
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.
What happens when I don’t have an ads.txt file?
As I explained above, the ads.txt file was introduced to prevent ad fraud and advertisers to pay for impressions that never happened. Since most readers of this tutorial are probably publishers, you are probably asking yourself why you should bother since this only means additional work for you.
Imagine that the ads.txt standard is widely adopted, the following fictional story becomes very likely.
Advertiser SuperCarParts is purchasing ads for her local car parts store from ad network BestCarAds, which promises her to deliver ads on various websites related to cars in her region. When she gets the invoice she sees that they billed her for 100,000 ad impressions on LocalCarFriends.com, which is the website of a local club of car enthusiasts. It seems very related and a good deal.
For whatever reason, maybe there was no sale or maybe SuperCarParts was just curious, she wanted to check if those impressions were really sold. When she opened LocalCarFriends.com/ads.txt, she does not find the BestCarAds network listed there. This gives her a reason to ask for her money back.
Guess what, LocalCarFriends.com actually delivered those ads and collected good money for their next public event. They just forgot to add the information into the ads.txt file. Unfortunately for them now, the advertiser had to freeze the payment.
What a sad story. You might say that this would not have happened without the whole ads.txt standard. However, not every BestCarAds network has good intentions and real traffic and more and more advertisers are demanding proof of authorization to sell ad inventory.
You need to make sure to have the ads.txt file in place keep getting a piece of the cake. This will also make it harder for fraud companies to get paid for impressions they supposedly sell on your website but don’t, and hopefully, get that advertiser to pay you through a legit channel. So here is your direct win.
The story above is very simplified. A large chunk of ad inventory is not even sold in direct relations between advertiser, network and publisher, but through an ad exchange with multiple partners interacting continuously.
In an ideal world, all this is automatized. SuperCarParts would have a list of interesting websites they would like to buy traffic from and a program checked the ads.txt files on each domain for the authorized seller. They would then connect their own ad server to an ad exchange buying ad space on those URLs automatically. Their server would only accept requests from sellers through the exchange that they know is also listed in the ads.txt file.
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 writing any files. It even adds the correct entry for AdSense automatically.
- Install and activate Advanced Ads as described here
- Go to Advanced Ads > Settings > General > Ads.txt and enter the content of the file
- Save the settings
- if Advanced Ads recognizes a third-party ads.txt, it offers you to import the entries and replace the file
- Check if the file was created under yourdomain.com/ads.txt
You can find detailed instructions and further information about this feature in the ads.txt manual.
What does the ads.txt contain?
Enough with the stories, let’s take a look at some examples
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., AdSense
- networks and partners who use their account to sell ads on your behalf on your domain
- 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., blog.example.com) or subdirectory (e.g., example.com/blog) then the ads.txt would still need to be placed under example.com/ads.txt.
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 are 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 ads.txt 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 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 record for a normal AdSense account:
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
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.example.com, placeholder, DIRECT, placeholder
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 ads.txt 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 adnetworkone.com, 12345, DIRECT, a93idljl9b adnetworkwest.com, 32121, RESELLER, f496211 bestadnetwork.com, 123ABC, DIRECT CONTACTfirstname.lastname@example.org CONTACT=https://example.com/advertising SUBDOMAIN=blog.example.com
The example above means that you would need to have an ads.txt for blog.example.com as well with the information relevant to that subdomain.
Who is reading my ads.txt?
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 ads.txt 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 ads.txt 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 an ads.txt that is available on the subdomain and link it from the main ads.txt file using the SUBDOMAIN value. If the ad partners are allowed to sell inventory on main domain and subdomain then one ads.txt 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.
Here are the most important and updated sources about ads.txt if you have further questions or anything changes: