The perfect ads.txt file

12th July 2018

ads.txt files are very flexible, and so long as you follow the basic syntax and formatting it really doesn't matter how you include your data, but that doesn't mean it's not a good idea to maintain some structure and consistency in your ads.txt files, if not for the crawlers but for your own sanity when you come to update them.

Of course, if you use ads.txt Guru to manage your ads.txt files then they will be automatically formatted and validated, but if you've chosen the good old fashioned method of using a text editor then here are some tips to help you format your ads.txt file and avoid common mistakes.

  1. Use Consistent Case
    Domain names are case-insensitive, but keep them lowercase to maintain consistency and help you identify mistakes and duplicate records. We like to use uppercase 'DIRECT' and 'RESELLER' relationship values, and certification authority IDs are always lowercase. But remember, if your publisher IDs include uppercase characters these likely need to be maintained.
  2. Whitespace
    It doesn't matter if you want to go crazy and include spaces through-out your ads.txt file, but it does look a bit silly. Make sure you include a space after comma delimiters to ease reading, but that's it, don't include any other spaces in your data records.
  3. Minimize Comments
    Comments are useful, particularly to help keep track of which ad network each section of records are associated to (if you haven't been sensible and used ads.txt Guru to manage this for you), but keep them to a minimum. Avoid using inline comments on the end of data records, whilst these are valid that doesn't guarantee every crawler will handle them correctly.
  4. Include Certification Authority IDs
    Whenever possible, include the certification authority ID - not every ad network has one because frankly, they are rather expensive, but if they do it should be included.
  5. Add a Contact Record
    Including a contact record is a great way to ensure potential advertisers know how to contact you. We don't recommend including an email address because it won't be long before a spam bot finds it, but including a URL to your contact form is ideal.
  6. Don't Forget Your Subdomains
    If your website uses subdomains which use separate ad networks then create separate ads.txt files for them, and ensure you include a subdomain record in your main ads.txt file.

An ugly ads.txt file made beautiful...

Here's a frankly ugly ads.txt file:,12345678, direct, ab01cd23ef45gh67 # Ad Network A
 EXAMPLE.COM,12345678,Reseller# ad network a , 12345678,DIRECT # AD NETWORK B

Made beautiful:

# Ad Network A, 12345678, DIRECT, ab01cd23ef45gh67, 12345678, RESELLER
# Ad Network B, 12345678, DIRECT

Both ads.txt files are equally valid, but which would you rather work with?