Do you want to create and manage an ads.txt files in WordPress? Ads.txt file protects publishers from ad fraud, and it can potentially increase your ad revenue. In this article, we will show you how to easily create and manage ads.txt file in WordPress.
What is Ads.txt File?
Ads.txt file allows publishers to declare who can sell ads on their website. It is an initiative created by IAB Tech Lab, a non-profit focused on improving digital advertising standards.
The initiative is supported by Google’s advertising platforms like Google Adsense, Doubleclick, and Ad Exchange. It is also supported by many other leading digital advertising platforms.
Why is Ads.txt file important?
Ad fraud cost millions of dollars in damages to online advertisers and publishers each year. People with malicious intent continuously try to trick ad platforms with domain spoofing, fake clicks, fake impressions, and more.
Ads.txt file improves transparency in online advertisement by allowing publishers to declare who can sell their ad inventory. Here is how it works:
If you are an advertiser and someone tells you that they can display your ad on a particular website, then you can go and checkout that website’s ads.txt file. It will show you if the company you are dealing with has the permission to sell advertising space on that particular website or not.
Since this data is publicly available, it can be crawled, stored, and searched by advertisers, publishers, and resellers.
If you are displaying ads on your website using Google Adsense, DoubleClick, or Ad Exchange, then adding Ads.txt file is recommended.
Many other advertising platform and software also support or require ads.txt file to be declared.
How to Create and Manage Ads.txt Files in WordPress?
First thing you need to do is install and activate the Ads.txt Manager plugin. For more details, see our step by step guide on how to install a WordPress plugin.
Upon activation, you need to visit the Settings » Ads.txt page to configure plugin settings.
The plugin provides a simple text area where you can add lines to declare each individual platform or reseller. For example, you can add the following line to declare Google Adsense.
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
Don’t forget to replace pub-0000000000000000 with your own publisher ID.
As you can see, this line has four fields separated by comma. The first field is the domain of the company allowed to sell or resell your ad inventory. After that it has your publisher ID which corresponds to your account ID in the advertising platform.
The third field declares relationship type DIRECT or RESELLER. The last field is optional, and it represents an ID of the advertising platform. For all Google advertising programs, you’ll use the same unique ID.
Troubleshooting Earnings at risk Error in Adsense
A missing declaration in your ads.txt file may result in the following warning message in your Google Adsense account.
Earnings at risk – One or more of your ads.txt files doesn’t contain your AdSense publisher ID. Fix this now to avoid severe impact to your revenue.
This message indicates that your ads.txt file doesn’t have your publisher ID. To fix this message, simply go to Settings » Ads.txt page to make sure that you have correct publisher ID in plugin settings.
Note: Since ads.txt file is supposed to be in the root directory of a domain name, this plugin currently only works for root level domain like example.com. It does not work for WordPress installed in subdomain, subdirectory, or a single site in a multi-site network.
We hope this article helped you learn how to create and manage ads.txt file in WordPress. You may also want to see our guide on legit ways to make money online blogging with WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Followed everything but when time to check it appears cannot be found. what should I do?
If you do not have an ads.txt file then you can create one, not all sites have one created for them by default.
I worked with infolink before with this plugin. It worked properly. Now got adsense approval too. So need to add adsense ads.txt code to here. Without losing infolink can I add that file too?
You would add the new information on a new line of your ads.txt file.
I do want to insert ads text on my wordpress website and will this work or is there any other recommendation to carry out this action.
You would want to check with who you are wanting to include ads from for how to add those to your site. This guide is to help limit what can include ads on your site rather than adding more to your site.
i have added ads.txt from google adsense, and now i need to add ads.txt from another site and in file manager it refuses to create another ads.txt file, what can i do ?
Rather than creating another, you would want to modify your ads.txt with the recommendations from the different platforms you want to include.
Thanks, it is very helpful
You’re welcome
Very helpful, the plug-in was very easy to install and use.
One question: now that my Ads.txt file is installed and running smooth on my site, is it okay to delete the plugin? Or would doing that also delete the Ads.txt file? I ask only because I try to minimize the number of plugins on my site, since each extra plugin makes the site that little bit heavier/slower etc.
Thanks again.
You would want to check with the plugin’s support for how they handle that currently but for how plugins affect your site speed, we would recommend taking a look at our article below for a better understanding:
https://www.wpbeginner.com/opinion/how-many-wordpress-plugins-should-you-install-on-your-site
Wow! I’ve been trying to figure this out for almost an hour now! This article totally saved me! Thanks!
Glad our article was helpful
This page has saved my bacon on more than one occasion, thank you.
You’re welcome, glad our guide could assist you
Hey there,
I am getting an error regarding there already being an ads.txt file on my wordpress, although there shouldn’t be? Strange.
You may want to check with your hosting provider to ensure there was no hiccup from their end.
Thanks For share with us it”s Very helpful for beginner.
Thank You a lot !!!
Glad you found our content helpful
Thank for sharing the article, i,m also facing the same issues.
I just want to know that, i have to update same code or need to do any change.
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
You need to replace the pub-0000000000000000 with your own publisher ID
Always helpful, always to the point, thats why any time I need help I use wpbeginner.
Thank you so much!
Vana Verouti
Thank you, glad our content can be helpful
If i upload txt file in file manager on my control panel instead adding new plugin compare to add a plugin and put code in it, would it have same speed for loading my website or is it that plugin based set up affect the speed?
The speed difference shouldn’t be noticeable between the two methods
Thanks, you’ve always been a great help!
Glad our guides have been helpful
My team and I just got our AdSense approved. We installed the Ads.txt plugin but I noticed all our articles had a change in their URLs.
On tracing it, I saw that that ads.txt code of “google.com, pub-account, DIRECT, blah blah blah” is being added to every of our post URL making it look like “www.example.com/google.com, pub-account, DIRECT, blahblabhblah/post-name/
It really looks disturbing.
Please, how can I remove it without disturbing the ads.txt?
The ads.txt shouldn’t modify your permalinks, you would want to start by checking your permalink settings under Settings>Permalinks to see what is set there as well as resaving your permalinks
wpbeginner,
You are a savior. You have answers to all my questions.
Thanks a lot
Glad we can help answer your questions
i got approved, and i had the warning, i quickly installed and activated the plugin and the warnings disappeared. But days later, my ads stopped showing on my site (it wasn’t a ban or suspension). it just leaves blank ads spaces. The thing now is that the ads show sometimes, and most times it doesn’t which has made my earnings very poor.
For what it sounds like, you would want to use Google’s ads not displaying troubleshooter to see if there are any issues, otherwise, it could be there are no recommended ads to match the content on your site.
Is there any way this can be done without a plugin?
Yes, you would manually upload the ads.txt file to your site using either your host’s file manager or FTP and you could create the file using notepad or a similar text editor.
Hey, I have added it like it states in this article, but when I go to google ad sense it says the same earnings at risk message. How do I resolve this?
You may need to give some time for Google’s cache to clear so it recrawls your site
Thank you so much. I had no idea why my ads had gone blank. After adding ads.txt everything is working fine.
Glad our guide could help solve the problem
Nice article, really helpful but will the Ads.txt plugin be automatically added to my site’s root domain? i mean, it seems really simple. Are you saying all i need to do i download the plugin, copy the google code, replace the pub id with mine and save changes. What about adding the txt file to the root domain? Will the plugin do that automatically?
Yes, the plugin should create that file and place it for you
Thanks for your article
You’re welcome, glad you like our article
Hello,
We have 2 google adsense accounts how to add both of them. I add two lines :
google.com, pub-first-account, DIRECT, f08c47fec0942fa0
google.com, pub-second-account, DIRECT, f08c47fec0942fa0
or how ?
Thank you
You’re correct, that would be how to add a second accepted advertiser on your site
I am searching for this tactics long time. Thanks for sharing with us.
You’re welcome, glad our article could be helpful
Thanks for your article. I was able to add Ads.txt on my website using the plugin recommended. But, Google Adsense is still not showing on my website; its still blank as before. What could be the problem?
There are a few possible reasons for ads not showing, if Google hasn’t recrawled your site that could be the simplest. Otherwise, you would want to go through their troubleshooter for the cause and fixing the issue.
Thank you for your explanations. I was able to add Ads.txt on my website using the plugin recommended. But, Google Adsense is still not showing on my website. What could be the problem?
The most common reason is either your site’s caching or if your robots.txt may be preventing the file from being crawled. Google does take time to recrawl your site as well.
i hv domain and subdomain too, how can i fix this, as u hv been told it would work on main domain only.
For the subdomains, you would need to manually create an ads.txt file and in your primary domain, note the subdomain for your site.
I hv 2 adsense, one for main domain and another for subdomain. Now I hv addeed txt file for main domain adsense only. Can i add both publishers id in one txt file.
You could add both publisher ids to the ads.txt file but you would want to make sure the correct id is in the subdomain’s file.
Thanks. For a novice like me, you have been a great help in setting up my website.
The most important thing is that your information is always to the point, and trustworthy. Whenever I face any problem, I search on your website. And if I have found what I am searching for, I know that my problem will now be definitely resolved.
Glad our guides could be helpful
Thanks for sharing this guide. It was really helpful
Glad our guide could help
The Plugin says; Untested with your version of WordPress, any other way?
For that message, you would want to take a look at our article here for understanding it: https://www.wpbeginner.com/opinion/should-you-install-plugins-not-tested-with-your-wordpress-version/
Hii, nice information. I had applied this procedure but it was still showing the same message. What was the issue.
If you just added the ads.txt then you would need to wait for Google to recrawl your site for the error to disappear.
So done all of that and still showing in my adsense same warning. I am sure it will update soon and thank you for this simple to follow guide.
Glad our guide could help
Im geting errors with my site
Im told html corrupt after visiting
Please help
Ads are still not showing after 48hours
you may want to try disabling any caching plugin on your site, if that resolves the issue you would want to exclude your ads.txt from your caching plugin.
Thanks for the advice
I’m no longer getting html corrupt after visiting the ads.txt
I went to exclude and entered the link above
I’m so grateful
I only hope my ads will start showing after 24hours
Thanks again
Cheers!
Glad our recommendation could help
Thank you very much. I thought I needed to ad another page to the site.
Glad our article could help
This was super helpful! Thanks!
Glad our article could be helpful
Thank you, really helpful when I got a little lost in the process.
I did as instructed and two days later I’m getting the same warning from Adsense. :/
Nice, i was looking for this plugin, so i do this..is easy. Thanks for the help.
I recently used ads.txt plugin to install ads.txt file to my website I made all the changes as instructed but still my ads.txt page is showing blank. Can you please check and revert ASAP or can I use another plugin to make things live?
Is there a ‘No-Plugin’ way of doing this thing.
Everytime there is an update for something, a plug-in pops up out of nowhere as a solution.
Bizarre that one would need a plugin for something so stupidly simple trivial!
I have a normal Adsense approved website, so should I add Ads.txt file to it ? Is it important?
Hi Fahad,
It is not required but recommended. It is important as some advertisers may not want their ads to appear on websites with no ads.txt file which could affect your website’s earning potential.
Can you please make a video tutorial on it ?
What do you need a video for?
Man, this article is self explanatory.
Some people absorb lessons better if they can watch it in a video, we understand wanting all of our articles in video form
Great article. I’ve been getting this message on my Google Adsense account.
The strange thing is that when I click on the link Google gives me, it’s not my website, but a big gaming site named . So, I’m not too sure why it’s telling me to fix my ads.txt file when it’s in the correct order, and indicating the incorrect domain.