Ads.txt Implementation Guide

Overview

ads.txt (Authorized Digital Sellers) is an initiative from IAB Technology Laboratory. It specifies a text file that publishers host on their web servers, listing other companies authorized to sell their products or services.

This is a mechanism for publisher content distributors to publicly declare their authorized advertising systems and identifiers within those systems. It also describes the format for encoding the instructions to be consumed by advertising systems and their customers. Advertising systems should retrieve these declarations before buying or selling advertising claiming to be on the website.

The ads.txt file gives more control over who's allowed to sell ads on a site and helps prevent counterfeit inventory from being presented to advertisers during the real-time bidding process.

How does Ads.txt work

Publishers need to add the ads.txt file in the root directory of the website as a top-level domain, confirming their ownership of the domain and indicating partner accounts (such as ad exchanges and SSPs) eligible to sell their ad inventory. As a result, advertisers can easily access the list of all authorized publishers and their ad inventory online.

When the advertiser receives a bid request from the publisher, all he has to do is match the publisherโ€™s account ID with the ads.txt file.

If everything matches, the advertiser can be sure that the publisher is legitimate. On the other hand, if the buyer discovers that the publisherโ€™s ID isnโ€™t validated, he can decide not to bid on the publisherโ€™s ad inventory.

The easiest way to validate ads.txt is to enter the URL in the browser and check if it opens. The URL will be:

websitename.com/ads.txt

Ads.txt on Snigel CDN

Hosting ads.txt on the website is a mandatory part of the AdEngine setup. An optimized ads.txt for your website is hosted on the Snigel CDN at:

https://cdn.snigelweb.com/adengine/{domain}/ads.txt

Note:

  • Replace {domain} with the actual website domain

  • The protocol can be either HTTP or HTTPS. The file is available through an HTTPS and HTTP connection. However, it is advisable to prefer HTTPS connections over HTTP when crawling ads.txt files

The ads.txt file is automatically updated on the CDN to reflect the latest state of the website setup. The website must always use the latest ads.txt version available to maximize revenue.

How to implement ads.txt

There are several ways to add an ads.txt file to the website or app, depending on the CMS or service that is used.

It is recommended to use the Redirect option, because:

  • ads.txt will always be up to date, ensuring an optimal configuration and improving revenue

  • No additional effort to manually update the file or implement automatic updates

Redirect

The recommended method of ads.txt hosting is to redirect /ads.txt to the Snigel CDN ads.txt file.

The IAB ads.txt specification allows multiple redirects within the scope of the websiteโ€™s root domain, but only a single redirect to a destination outside the original root domain. In addition, it authorizes the response to have the following status codes: 301, 302, and 307. The redirect must be implemented as a single hop to the Snigel CDN.

Implement Redirect on CMS

Many of the available CMSs in the market support redirect, and since some will even override CDN settings, this is the advised place to do the redirect whenever possible.

Implement Redirect on CDN

If the website is delivered through a CDN, like for example Cloudflare, implement the redirect on the CDN level through the CDN provider UI or API. Consult your CDN provider's documentation on how to implement redirects.

Cloudflare Guide: URL forwarding | Page Rules ยท Cloudflare Rules docs

Traffic must pass through Cloudflare for Page Rules to work. If you only use Cloudflare for DNS, Page Rules are not active.

Implement Redirect on Apache Web Server using .htaccess

If the website is using Apache as a web server, implement the redirect in the .htaccess file by adding the following line:

RedirectMatch 301 (/ads.txt)$ https://cdn.snigelweb.com/adengine/{domain}/ads.txt

Note:

  • Replace {domain} with the actual website domain

This will instruct the web server to return a permanent redirect 301 to the ads.txt file on the Snigel CDN.

Direct hosting

You can host ads.txt directly on your web server by downloading the latest ads.txt delivered through the Snigel CDN and adding it to your root domain and any subdomains as needed.

It is recommended that the ads.txt file is updated regularly, either manually or by implementing an automatic download or synchronization job.

Required HTTP response headers

The ads.txt file must be accessible via HTTP and/or HTTPS from the website path /ads.txt.

The HTTP response needs to contain the following headers to be accepted by the advertiser's crawlers:

  • Content-Type: text/plain; charset=utf-8

Additional implementation details can be found in the official IAB ads.txt specification.

Validate Ads.txt

Test that ads.txt is publicly accessible on the URL:

websitename.com/ads.txt

If you have implemented ads.txt using a redirect to the Snigel CDN, you should see in the browser address bar http://cdn.snigelweb.com/adengine/{domain}/ads.txt or https://cdn.snigelweb.com/adengine/{domain}/ads.txt

The browser should show an ads.txt file similar to the following example:

# Ads by SnigelWeb Services Ltd # Ads.txt Updated 15/11/2022 managerdomain=snigelweb.com contact=sales@snigel.com ownerdomain=yourdomain.com snigelweb.com, 1111, DIRECT google.com, pub-1320774679922222, RESELLER, f08c47fec0942fa1 appnexus.com, 3333, RESELLER, f5ab79cb980f11d2 ...