Ads.txt is a standard introduced by the IAB Tech Lab, a non-profit organization that includes notable members like Google, Yahoo, and Microsoft. The file acts as a verification method, ensuring that specific ad networks are permitted to sell ad space on your site.
While the ads.txt is not mandatory, it is requested by many networks, including Google AdSense, and may become necessary in the future. If you’re a publisher using an ad network on your WordPress site, you probably need to create and manage an ads.txt file.
Table of Contents
What does an ads.txt file do?
When an ad network contacts you to sell ad space on your site, they will provide the information you need to add to your ads.txt file. Once you’ve inserted this into the file, it signals that the ad network has your permission to sell ads on your site. The file sits quietly in the root directory of your website and can be accessed via https://example.com/ads.txt
.
The acronym “ads” stands for Authorized Digital Sellers, highlighting that the file does not list individual ads or campaigns but the companies permitted to sell ad space. While not yet mandatory, many networks are advocating for this standard due to its benefits.
Creating an ads.txt file in WordPress
Creating an ads.txt file can be accomplished manually or using a plugin.
Using Advanced Ads
With our Advanced Ads plugin, you can manage your ads.txt content without code editing, thereby simplifying the process.
Step-by-step guide:
- Install and activate Advanced Ads as described here.
- Go to Advanced Ads > Settings > General and enter any content required by your ad partners.
- Save the settings.
- If Advanced Ads recognizes a third-party ads.txt, it offers you an option to import the entries and replace the file.
- Check the outcome by pointing your browser to
yourdomain.com/ads.txt
. - The plugin-generated file starts with # Advanced Ads ads.txt, making it easy to confirm that it was generated by our plugin.
Creating the ads.txt manually
To create the ads.txt file manually, open your text editor, create a new document, and start filling in the needed information. Afterward, upload this file via FTP to the root directory of your website.
Understanding the content of ads.txt
The ads.txt file contains a list of accounts authorized to sell ad inventory on your website. Your ad partners provide the content that goes into the file, which should be located in the root domain, not in a subdomain or subdirectory.
The file contains one record per ad account. There are three types of records:
- Data records (most common),
- Variable declaration records (a newer format)
- Comments (which start with # and are ignored).
Data records consist of four entries, separated by commas. A typical entry looks like this:
- Advertiser Domain
- Publisher Account ID
- Account Type
- Certification Authority ID
While the first three entries are mandatory, the Certification Authority ID is optional. 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 authorized by you to monetize your site.
Variable declaration records
A record in the ads.txt can consist of a variable and its value. It basically looks like this:
VARIABLE=VALUE
While VARIABLE
is a string without any whitespace, VALUE
can contain anything. For better readability (for humans), these entries go to the bottom of the file. Technically, they can go anywhere as long as they are in their own line. You can also specify the same variable multiple times. The parsing bot should consider all of them.
The list of variables is defined. At the moment, there are only two:
- CONTACT: Human-readable contact information, such as the name, email, and phone number of the person managing ad placements.
- SUBDOMAIN: The URL of a subdomain where an ads.txt file relevant to that subdomain can be found.
Google now crawls and enforces ads.txt files placed on subdomains, provided they are referenced in the ads.txt file of the root domain.
Example of an ads.txt entry for Google AdSense
If you don’t provide an ads.txt file, you will see a warning in your AdSense account that the plugin imports into your dashboard: “Earnings at risk – You need to fix some ads.txt file issues to avoid severe impact to your revenue.”
The ads.txt entry for Google AdSense looks like this:
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
Code language: CSS (css)
You only need to replace pub-0000000000000000 with your unique publisher ID to create a valid record for your ads.txt. Advanced Ads will automatically generate it in the correct format if you connected it to your AdSense account.
Example of an ads.txt file
This example file incorporates the details mentioned above. In practice, ads.txt files can be much longer, especially if multiple ad networks are in use on a site.
# this is an example for a comment
adnetworkone.com, 12345, DIRECT, a93idljl9b
adnetworkwest.com, 32121, RESELLER, f496211
bestadnetwork.com, 123ABC, DIRECT
CONTACT=yourmail@example.com
CONTACT=https://example.com/advertising
SUBDOMAIN=blog.example.com
Code language: PHP (php)
The SUBDOMAIN entry indicates that ads are served on two separate instances of the website: the main domain and a subdomain. Therefore, each needs its own ads.txt file—one for the main site and another for the subdomain—containing the relevant ad information for each.
ads.txt on subdomains and multisites
According to IAB Tech standards, an ads.txt should always be placed on the root domain and not a subdomain. 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.
If you have different partners on a subdomain only, you need to place that information in a file 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 root domain and the subdomain, then one ads.txt file is sufficient.
Whether on a subdomain or not, you should only include information from those you trust to monetize your site responsibly into your ads.txt file.
Manual backup of the ads.txt file
In some ad setups, you may choose to delegate control of the ads.txt file to a third-party provider. This provider can then manage and update the file directly on your behalf, ensuring that all necessary and authorized ad networks are included. This setup can be useful for maintaining an optimized and up-to-date ads.txt, which reduces the risk of revenue loss due to missing or incorrect entries that can prevent ads from being served.
Backing up your ads.txt file can be crucial when relinquishing control to such a provider or in certain other situations. This includes instances where server issues might lead to file corruption, an ad manager has only limited access, or if you need to make manual updates. Keeping a backup helps ensure continuity in ad revenue and minimizes the risk of interruptions.
Below, we’ve provided a step-by-step guide on how to manually back up your file via FTP in a WordPress environment if automated backup isn’t available.
Via FTP access:
If you have FTP access, you can get to the server and download the ads.txt file, saving it to your local system. Here are the steps for manual backup via FTP:
Access your website via FTP
- Use an FTP client like FileZilla or Cyberduck to connect to your WordPress site’s server.
- Enter your FTP credentials (host, username, password) provided by your web host to establish a connection.
Navigate to the ads.txt file location
- Once connected, locate your WordPress root directory. This is often labeled as public_html or similar, depending on your host.
- Within this directory, you should find the file, usually placed at the root level of your site.
Create a backup
- Right-click on the ads.txt file and select the Download option to save a copy to your local computer.
- Alternatively, rename the existing ads.txt file on the server:
- Right-click the ads.txt file.
- Select Rename and change the filename to something like
ads_backup.txt
. This will allow you to preserve the file as a backup on the server itself while a new ads.txt file is created.
Through your web browser:
You can also open the existing file in your web browser, copy its content to your clipboard, and paste it into a text editor of your choice for saving. Follow these steps for the browser method:
- Open your web browser and go to your website’s ads.txt file location (typically,
yourwebsite.com/ads.txt
). - Select all the text and copy it (Ctrl+C for Windows or Command+C for Mac).
- Open your text editor and paste the copied text (Ctrl+V for Windows or Command+V for Mac).
- Save the file to your desired location.
With these methods, you can manually back up your ads.txt file when you can’t write to it directly or if you encounter filesystem issues.
Who reads this file?
Technically, several bots routinely check the ads.txt file, typically 2–5 times per day on a smaller site. According to the IAB Tech Lab standards, ad partners are expected to read the ads.txt file to ensure all entries are correct. Large networks, such as Google AdSense, use automated bots.
There isn’t a central organization responsible for checking the ads.txt file. Each network and ad partner may deploy their bot and parser to interpret the file. Following the IAB Tech standards, these bots should receive consistent information across all platforms.
The IAB Tech standard also recommends that bots check the ads.txt file no more frequently than once every 7 days and cache the file’s contents in their systems between checks.
The ads.txt file functions similarly to the robots.txt file, with voluntary adherence. While the ads.txt file defines authorized sellers, an ad network could theoretically sell ad inventory from a site without proper authorization if they bypass the file entirely.
Troubleshooting ads.txt issues
Persistent warnings from AdSense and Advanced Ads
If you’ve created your ads.txt, but the below warning persists in the Advanced Ads dashboard, simply dismiss it. AdSense may take a few days to verify your file and will automatically remove the warning once it does.
Earnings at risk – You need to fix some ads.txt file issues to avoid severe impact to your revenue.
My ads.txt doesn’t show up at all
Advanced Ads only creates a link to the file if you enable the feature and either enter content in the ads.txt settings (Advanced Ads > Settings > General) or add the AdSense publisher ID.
Incorrect entries in ads.txt
Clear your browser cache and refresh the ads.txt link. If this does not resolve the issue, check for caching plugins that might delay changes in thi file.
If # Advanced Ads ads.txt
isn’t appearing at the top of the file, it indicates that either an existing file in the root directory of your website or another plugin is overriding our settings. Locate the source and remove it to utilize the Advanced Ads feature.
cURL errors
Errors like cURL error 51: SSL: no alternative certificate subject name matches target host name XYZ
indicate issues with your SSL setup. Consult your web hosting provider or review your SSL settings to correct this.
“File not created” error
The message from Advanced Ads is displayed because the plugin can’t create an ads.txt file if there is a manually placed one already there.
If you want to let Advanced Ads manage your ads.txt, just delete the file in your root directory and enable the option under Advanced Ads > Settings.
Additional notes and resources
- Developers can add their content to the ads.txt file generated by Advanced Ads using the advanced-ads-ads-txt-content filter.
- Advanced Ads does not generate a physical file, so you won’t be able to see it using FTP.
- Some advertisers may require a manual integration of their “own” ads.txt file to work correctly. Do that and contact them if you need to include other entries in your ads.txt.
Frequently Asked Questions
An ads.txt file is a publicly accessible text file that website owners use to list authorized digital advertising sellers. This standard, created by the Interactive Advertising Bureau (IAB), helps prevent ad fraud by verifying legitimate sellers, ensuring that advertisers can trust the listed sources for ad placements.
In AdSense, the ads.txt status indicates whether your file is correctly set up and recognized on your website. A warning may appear if the file is missing or incorrectly configured, as this can affect ad revenue. Once correctly set, AdSense verifies authorized ad inventory.
An ads.txt validation test checks if your ads.txt file is properly formatted and includes valid entries. Many ad networks, including AdSense, use this test to confirm that only authorized sellers are listed. Validation helps ensure correct implementation, preventing potential revenue loss from unauthorized sources.
In your ads.txt file, include lines for each authorized seller, listing the ad network domain, your account ID, relationship type (DIRECT or RESELLER), and an optional certificate authority ID. This format ensures that ad networks and buyers know which sellers are verified for your ad inventory, enhancing ad transparency.