Ads.txt Example: How to Implement Ads.txt for Your Website

Illustration for an ads.txt example guide

Technically reviewed by Aditya

What is ads.txt?

Subscribe to our newsletter

Ads.txt, or Authorized Digital Sellers, is an initiative launched by the Interactive Advertising Bureau (IAB) in 2017 to combat ad fraud. Ads.txt is a publicly accessible text file that lists all of the authorized sellers of your website’s ad inventory.

When ad buyers purchase ad space through an authorized seller, they can be confident that the ads are being served on your website and not on a fraudulent website. This helps to protect your brand reputation and to ensure that your advertising budget is being used effectively.

Advertisement

How to implement ads.txt

To implement ads.txt for your website, you will need to create a text file called ads.txt and place it in the root directory of your website. The file should contain a list of all of the authorized sellers of your website’s ad inventory, one per line. Each line in the ads.txt file should contain the following information:

• The domain name of the authorized seller

• The seller’s account ID

• The relationship type between you and the seller

• Optionally, a certification authority ID for the ad system (the IAB Tech Lab spec marks this fourth field as optional)

Ads.txt example

Here is an example of an ads.txt file. Both IDs are placeholders: swap in the real values your partners give you.

google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0

exchange.example.com, PLACEHOLDER-12345, RESELLER

This ads.txt file lists two authorized sellers. The first line is the AdSense line, with pub-0000000000000000 standing in for your own publisher ID. Its relationship type is DIRECT, which means you control that account yourself. The second line uses a made-up exchange domain and ID. Its relationship type is RESELLER, which means you have allowed another company to control that account and resell your ad space through that exchange.

Reading each line, field by field

FieldDIRECT lineRESELLER lineWhat it means
1. Ad system domaingoogle.comexchange.example.comThe domain of the SSP or exchange that buyers connect to. Required.
2. Account IDpub-0000000000000000PLACEHOLDER-12345Your seller account ID on that system. It must match the ID the system sends in bid requests. Required.
3. RelationshipDIRECTRESELLERDIRECT if you control the account. RESELLER if someone you have authorised controls it. Required.
4. Certification authority IDf08c47fec0942fa0(left out)An ID for the ad system with a certification body such as TAG. Optional, and the spec notes it may be deprecated later.

Lines that start with # are comments, so you can label each partner’s block without breaking the file.

ads.txt variables you may see

Besides seller lines, the spec allows variable lines written as VARIABLE=value. These are the ones in the current version, ads.txt 1.1:

VariableAdded inWhat it does
CONTACT1.0.1 (August 2017)Human-readable contact for whoever owns the file, such as your ad ops email. Optional.
SUBDOMAIN1.0.1 (August 2017)Points crawlers from the root domain to a subdomain that has its own ads.txt. Optional.
INVENTORYPARTNERDOMAIN1.0.3 (final release March 2021)Points to the domain of a partner allowed to monetise inventory inside your content, mainly for CTV and similar cases. Recommended where relevant.
OWNERDOMAIN1.1 (final release July 2022)The business domain of the company that owns the site. It should match the domain in your sellers.json entries. Recommended. More on OWNERDOMAIN.
MANAGERDOMAIN1.1 (final release July 2022)The domain of a primary or exclusive monetisation partner, used only when you do not sell your own inventory in a market. Optional.

Source: IAB Tech Lab ads.txt 1.1 specification.

Once you have created your ads.txt file, you need to upload it to the root directory of your website. You can then check that it is working with the RediAds ads.txt checker.

Where the file lives and how buyers read it

The file goes on your root domain at /ads.txt, for example https://example.com/ads.txt, served as plain text. The spec tells crawlers to prefer HTTPS when the file is available over both HTTPS and HTTP, so make sure the HTTPS version loads. Crawlers also cache the file. If your server sends no cache headers, the default expiry in the spec is 7 days, so a fix may not show up straight away.

Fix the ads.txt “not found” and “unauthorized” warning in AdSense

AdSense shows “Not found” when it cannot find an ads.txt file on your site, and “Unauthorized” when the file exists but your publisher ID is missing from it. The fix is the same four steps either way.

  1. Copy the snippet from AdSense (Sites, then the site with the warning). It looks like google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0, with your own publisher ID in place of the zeros.
  2. Paste it into ads.txt and upload the file to your root domain, so it opens at yourdomain.com/ads.txt in a browser. If you are not sure where the root directory is, your site builder or hosting provider can tell you.
  3. Check the file with the RediAds ads.txt checker to catch formatting problems.
  4. Wait, then click Check for updates on the Sites page. Google says changes can take a few days to show in AdSense, and up to a month if your site doesn’t make many ad requests.

Source: Google AdSense Help, Ads.txt guide.

Go deeper

Not sure your file is clean? Paste your domain into the ads.txt checker and see which lines buyers may ignore.

Advertisement

Keep learning