How to Create Ads.txt File for Adsense in WordPress

The ads.txt file is an initiative created by IAB Tech Lab to protect advertisers and publishers from fraud seller, fake click, spoofing, and others.

This initiative is also highly recommended for Google Adsense users (other platforms such as Doubleclick and Ad Exchange are no exception).

The reason is, ads.txt indirectly makes ads appear more optimal, and at the same time advertisers do not lose money due to fake ad slots.

So, how to create an ads.txt file on a WordPress site?

Step 1: Create ads.txt file for Adsense

1. Right click on the desktop then select New Text Documents.

2. Name it ads only (no need to add .txt because the format already is).

ads.txt wordpress

3. Copy one of the following lines of code based on your publisher status.

google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
google.com, pub-0000000000000000, RESELLER, f08c47fec0942fa0

Confused? Here I describe the code definition:

google.com – because it is a Google service, the domain is automatically google.com. You don’t need to change this value if you use Google Adsense or Doubleclick.

pub-000000000000000 – is your publisher code which can be found on the page Adsense AccountAccount InformationPublisher ID. Please replace it with your own code.

See also  3 Ways to Fix ERR_BLOCKED_BY_XSS_AUDITOR in WordPress

DIRECT – gives a signal that you are a publisher who has full control of the account but does not sell ad slots to third parties (the average publisher is this type).

RESELLER – means you are a publisher who also sells ad slots to third parties (usually only done by large publishers).

f08c47fec0942fa0 – is the identification code for Google. You don’t need to change this code.

So you only need one line: either way DIRECT or RESELLER.

ads.txt wordpress

4. If you have, click File → Save (CTRL+S) the file.

Step 2: Upload the ads.txt file to WordPress without a plugin

Since these additions are very minor, it’s best not to rely on plugins. Because, the fewer plugins means WordPress is getting lighter.

(Scroll down for a guide to using the plugin.)

1. Go to page cPanel you then select File Manager.

Usually, cPanel can be accessed via the address namawebsite.com/cpanel

create ads.txt in WordPress

2. Then in the folder list, double-click on the directory of the site you want to install ads.txt

create ads.txt in WordPress

3. After logging in, click menu Upload.

create ads.txt in WordPress

4. Upload the ads file that you created earlier. Can be dragged or through Select File.

create ads.txt in WordPress

5. If it has been uploaded, return to the File Manager page then click Reload.

create ads.txt in WordPress

You should see a file named ads.txt as follows.

create ads.txt in WordPress

How to use the ads.txt plugin in WordPress

Another way is to use a special plugin to implement the ads.txt code. You can take this method if you are not too familiar with using cPanel.

See also  How to Rollback WordPress Plugins Quickly

1. Install the plugin named Ads.txt Manager on your WordPress site. For more details, read how to install a WordPress plugin.

2. Then, enter Settings → Ads.txt → enter your ads.txt code.

create ads.txt in WordPress

3. Lastly, Save Changes.

This plugin does not support WordPress multisite yet. Therefore, the method by uploading the ads.txt file to the File Manager is recommended for multisites.

Step 3: Check the installed ads.txt file

To check whether the ads.txt file is accessible, you can visit the site using the format namawebsite.com/ads.txt

There will appear the ads.txt code that has been installed.

To see if there is a writing error in the code, you can use a tool called Ads.txt Validator.

ads.txt validation

Enter your WordPress address, then click Get Your Free Report.

Ads.txt Validator will tell you whether it is valid or not. If not, you will also be notified of the source of the problem and its solution.

Questions and answers about ads.txt

Here are some frequently asked questions about installing ads.txt that you may also want to ask.

What is ads.txt?

Simply put, ads.txt is a new rule that is useful for increasing publisher transparency so that the advertising ecosystem becomes healthier.

That way, advertisers are more confident in placing ads on your site.

Is ads.txt mandatory to install?

At the time this article was written, ads.txt was still optional. However, Google strongly recommends installing ads.txt on all websites that use advertising networks, including AdSense.

I even heard myself from Google that ads.txt will later become an obligation for AdSense publishers.

See also  3 Easy Ways to Install New Plugins on a WordPress Website

Updates: Now it’s mandatory to install, otherwise the ads won’t show.

Can ads.txt increase revenue?

There are no guarantees, but the existence of ads.txt makes your site safer than fraud thus increasing the opportunity for advertisers to install bidding higher CPC.

You can still increase Adsense CPC in various other ways.

Is it okay to install more than one ads.txt code?

Of course you can. If you use more than one advertising network, you can place the new code on the next line, either DIRECT or RESELLER.

Is ads.txt only for Google Adsense?

Not. Most of the major advertising networks now support ads.txt. Even if you use other advertising, this feature is still required to be activated.


Ok, that’s how to install an ads.txt file on a WordPress site. Not difficult is it? If you have any questions, please write them in the comments column!