How to add an ads.txt file to your website

Create and upload ads.txt to your blog (using a plugin, SFTP or SSH)

An ads.txt file is a simple text file that is uploaded to your root folder and includes information about the authorized sellers for advertising. Ads.txt or Authorized digital sellers is an initiative started by IAB tech lab to prevent digital fraud. It is now widely adopted and you need one on your website if you show ads. The ads.txt file gives you higher control over who is authorized to sell ads on your site which prevents counterfeit inventory from being presented to advertisers. Google strongly recommends using an ads.txt on your website, which includes your publisher id. If you are using adsense on your website you need to add an ads.txt file on your site including your adsense publisher id.  For example, an entry authorizing adsense on your website in the ads.txt file looks like this.

google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0

Your publisher id looks something like this: pub-7030005xxxxx9

The entry includes the seller, the account id or the publisher id, the type of relationship – like direct in the above entry – and at the end a unique certification authority id. If you are using more advertisers on your blog, you must include an entry for each one in your ads.txt file in the above detailed manner.

Plugin method to add ads.txt

While there are several advertising plugins like ad inserter and advanced ads, that allow you to add a virtual ads.txt file to your website, you can also add one directly to your root folder without using any plugin.

If you are running a wordpress website, you can easily add a virtual ads.txt file using a plugin like adinserter. The Adinserter plugin has an ads.xt button in its header toolbar. Install the plugin like you install any and then go to plugin settings.

Check for the ads.txt button in the header toolbar and click on it. It will open the virtual ads.txt file at the bottom for editing. If you are already using this plugin for laying ads on your blog, you will see that it automatically identifies your adsense publisher id from the adsense ads and adds it to your ads.txt file. However, if you are also laying ads from other publishers, you can add more entries by editing the ads.txt file. Click on the editing button and add more entries below the first one.

Upload Ads.txt File via SFTP or Cpanel

However, if you do not want to use a plugin, you can add a ads.txt file to your root folder. The plugin will add a virtual ads.txt file only when you do not have a physical ads.txt file in your root folder.

To add the file to your root folder, you can do it through SFTP or by logging into your cpanel account and then going to the file manager. The root folder is the one labelled public_html. If you are unaware of your document root, go to the domains section in cpanel and you can find the root folders for all the domains and subdomains in your account listed next to the domain names.

You can create a physical ads.txt file for your wordpress site using a text editor like notepad. Add the entries (one per line) using notepad and then save it as ads.txt. You can upload it now to your root (Public_html) folder. Once you have uploaded it, you can check the file by going to yourwebsitedomain.com/ads.txt (e.g. example.com/ads.txt). You can also do the same by connecting to your hosting account through SFTP. Connect to your account using Cyberduck or Filezilla and then upload the file to your root folder. It is as simple as that to add an ads.txt file to your website.

Create ads.txt file using ssh

You can also use a third method to create an ads.txt file for your website. It will require ssh connection to your server. Connect to your server using SSH. Once connected create a new file named ads.txt in your root folder. For example, if your root folder is located at /var/www/public_html, you can use the following command to create a robots.txt file for your website:

$ sudo nano /var/www/public_html/ads.txt

Add your entries into this file (one per line) and then close and exit using Ctrl X, Y and enter.

Your ads.txt file has been created and you can check it by going to the ads.txt url or domain.com/ads.txt.