Implementing an ads.txt file isn't a strict requirement, and ads will continue to serve without an ads.txt file. However, it's worth noting that many advertisers are choosing to only bid on ad requests that are ads.txt verified - learn more about ads.txt.
The ads.txt file is a collection of all the publisher IDs that are allowed to request for ads on your domain, and lives at the root of the domain (for instance, on example.com/ads.txt). A typical ads.txt file entry looks like this:
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
Usually the publisher ID used in an ads.txt file is based on the value of
data-ad-client from the ad tags. However, given that most AFP platform customers have thousands of child accounts, managing this file and even Google and other bidders' ability to process it, becomes difficult. There are two options for platform customers to solve this problem, and scale the usage of ads.txt on their platform domains. Platforms can choose to do either one of the options, or both in combination if required:
- Platforms can register their domains on the Public Suffix List
- AdSense can whitelist platform domains to be able to verify ad requests based on the
data-ad-hostparameter in addition to the
Option 1: register on the Public Suffix List
By registering a domain on the Public Suffix List, browsers will treat the domain as a TLD (top level domain). Our ads.txt verification system will do the same. Platforms should investigate the full impact this will have on their domain before making this change.
If a domain exists in the Public Suffix List, the location of the ads.txt file must be changed. Instead of publishing an ads.txt file on the root of the domain (example.com/ads.txt), the ads.txt files have to be posted on each subdomain (subdomain.example.com/ads.txt), and unless option 2 is also pursued, the ads.txt file has to contain the child publisher ID, or in other words, it's based on the value of the
As an example, if the child property code (
ca-pub-123456789012345, the ads.txt file will look like this:
google.com, pub-123456789012345, DIRECT, f08c47fec0942fa0
ca- portion of the string has been removed.
Option 2: special ads.txt treatment for platform domains
AFP has made it possible to verify ad requests based on the value of either
data-ad-host for whitelisted domains. This means if either of these IDs are in the ads.txt file, the ad request is processed as verified. This treatment will work even if the domain is listed on the Public Suffix List, where the only difference will be the location of the ads.txt file.
For most AFP platform customers, we recommend ensuring all ad tags have the
data-ad-host parameter set (alternatively you can use the "platform account" meta tag to ensure this is the case). And subsequently, the ads.txt file will only ever need one entry, which will be based on the host property ID (
As an example, if your host ID (
ca-host-pub-1234567890123456, the ads.txt file will look like this:
google.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0
ca-host- portion of the string has been removed.