How to Create and Place an Ads.txt File for Your Website

Did you get a notice in your AdSense account requiring that you put your AdSense publisher information on a published ads.txt file on your site?

If you don’t comply, your earnings will be much lower or even nothing.

In fact, all ad networks are requiring publishers to place an ads.txt file on websites with display ads.

This is in an effort to prevent display ad fraud.

Fortunately it’s easy to do.

How to create an ads.txt file listing advertisers

If Using AdSense

In your AdSense account, AdSense prompts you to click the Ads.txt requirement notification which will then generate the exact snippet you need to put into the ads.txt file.  The snippet should look exactly like the following but have your publisher information:

google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, YYYYYYYYYYYYYYY

In fact, here’s a screenshot of a scaled down Ads.txt file I use (all account info removed):

Screenshot of ads.txt file:

Sample of ads.txt file for advertisers (screenshot)

I’d give you a download to use, but I fear then if ever I run ads on this site, It’ll cause issues with advertisers given it’s a .txt file with advertiser names on it.  As you can see from the screenshot above, it’s super easy to generate.

The AdSense snippet is at the top followed by others.  Note, you don’t have to AdSense at the top.  I can be anywhere.

You must place only one advertiser per line.

If using an ad network like Media.net

They will provide you your ads.txt file.  They did for me.  Other ad networks did the same.

How to add an ads.txt file to your WordPress website

If using WordPress, go into your media library and upload it.  That’s it, you’re done.  Here’s a step-by-step screenshot.

How to add an ads.txt file to WordPress website (screenshot)

Ads.txt FAQ

Can I have two ads.txt files on my website?

I do and it’s not been a problem. I’m not sure if it’s technically incorrect.

However, if you have two ads.txt file and you have AdSense on your site, you need to put your AdSense snippet on both.  I received the warning from AdSense because while I had the snippet on one ads.txt file, it wasn’t on the other which triggered a warning (and a loss of 1 day’s AdSense revenue).

Adam Smith, who works for an advertising network, was nice enough to clarify this question.  Here’s what he told me:

A site can only have 1 valid ads.txt file and it must be placed on the route domain:

www.example.com/ads.txt

You can have one on a subdomain but you will still need one on the route domain and that should reference the subdomain ads.txt file (to be honest this is a super rare case).

Do you have to have one? Technically no. However that could change soon. At the moment if you have any ads.txt file an advertising network will check if they are in there and if not, they probably won’t buy your traffic. If you don’t have an ads.txt file they carry on as normal.

However, there is chatter than in June or July Google will be enforcing ads.txt. At the moment if you don’t have an ads.txt file then Google will carry on buying inventory from you as normal. Once they enforce it then they won’t buy from any site without an ads.txt file. And I assume that most other networks would then follow their lead.

More information provided by Adam here.

How long does it take for revenue to return once adding AdSense to ads.txt file?

About 24 hours. AdSense tells you this much and it’s true. I got a warning for not having the AdSense info on one of two .txt files.  I added it to the other and within 24 hours, I was earning again.

Do I need to place an ads.txt file for every ad network?

I work with 2 ad networks so I have two.  I suspect I could consolidate them, but I don’t bother.  Moreover, these files will change.  In other words, your ad network will provide you updated versions that you will need to update.  Therefore, I think it’s easiest having two such files.

Do I have to have an ads.txt file if I only use AdSense?

As far as I can tell, no, you don’t.  I have a site where I only use AdSense so I don’t have an ads.txt file on it and there’s no problem.  The AdSense notification is sent to you when you place an ads.txt file on your site required by some ad network but you don’t have your AdSense publisher information on that ads.txt.  However, perhaps in the future AdSense will require an ads.txt file even if you only use AdSense.

What if I didn’t get such a notice from AdSense and don’t have an ads.txt file, should I be concerned?

I don’t think so.  For now it seems the issue arises only if you have an ads.txt file missing your AdSense publisher information.  However, there’s no harm in adding one anyway.

27 thoughts on “How to Create and Place an Ads.txt File for Your Website”

  1. Good post thanks Jon 🙂

    I’m curious though – if you have two ads.txt files, are they both called ‘ads.txt’ but in different locations in your file structure; or are they both in the same folder but one is called ‘ads.txt’ but the second one is called say ‘ads2.txt’?

    1. Hey Paul,

      good question. One was put on my site by an ad network that provided it. The other I uploaded myself via media library. I named one ads.txt and the other slightly differently with ads in the name. I don’t know enough about this whether my set up is bad, but I’m not interested in combining them so I keep them separate.

      1. Having 2 ads.txt is technically wrong. Each domain must have a unique “Ads.txt” in root of the domain If I’m correct. eg: example.com/ads.txt, sub.example.com/ads.txt

        For Wordpress I recommend just uploading the ads.txt file manually in the root or by using some plugins such as “https://wordpress.org/plugins/ads-txt/”. Because uploading via Media Library won’t work because it just uploads the ads.txt into directory such as “wp-content/uploads/2018/02/ads.txt”

  2. I wonder why some sites are asked to provide this while others are not. No issues with my main adsense site at the moment. No ads.txt to generate and no alerts.

  3. I canceled my adsense account so that I could change my country and payment details.

    Since then my re-application has been denied 3 times. Thanks a lot Google… . #fkmylife

    1. Hey David,

      Yikes, that’s unfortunate. It’s a good reminder to not cancel an AdSense account. I suspect it’s much harder getting approved these days than it was a few years ago.

  4. This is really interesting to me. I currently generate around $8000 per month and haven’t gotten anything like this.

    I think you’re making more than me, but if there is a theory that this was only the websites that make a lot of money, I don’t know that this is the case.

    Wish I could proactively create it though…..just seems like a good idea

    1. Hey R

      if you’re just using AdSense, I don’t think it’s necessary. If AdSense hasn’t said anything to you, I wouldn’t bother. At your revenue level, you must have the ability to submit an email support request. If so, ask them if it’s necessary.

      I have the ads.text file because it’s required by the ad networks I use (Monumetric and Media.net).

  5. Thanks for the article Jon – very helpful.

    And I have a question I’m hoping you can answer. I run both Adsense and Media.net ads on my site. Media.net is also running third-party ads on my site, including ads from Adsense. Media.net has asked me to place an ads.txt file on my site.

    So if I create an ads.txt file, it looks like Google will need to be listed twice – once as a “direct” seller (with my Adsense publisher ID) and one as a “reseller” (with Media.net’s Adsense publisher ID). Do you foresee any issues with this (like Adsense having a problem with it)? Are you aware of any Adsense rule that does not allow me to run Adsense ads both directly from Adsense and through a reseller on the same site?

    1. Hey Karen,

      I have the same set up. Adsense is being run as reseller with multiple ad networks plus I added my own AdSense publisher details.

  6. Hi Jon,
    Previously i had no problem with Adsense. Though my earning is not significant but it was crawling. However, it was my mistake to “play” with Monetization ads.txt that i switched to “enable” with hope of getting more earnings.. then after i changed it, my earnings are dropping until today. I tried to go back to “disable” like it previously was. But still i am having low earnings and hurt my income 🙁 i only deal with Google and put my correct Publisher ID. Any advise? Thx u.. really appreciate it..

  7. Hi Jon, your article helped me, especially that I am using AdSense only. But I think you are right, now the message shows up for adding the ads.text file. And I noticed a huge decrease not in the revenue only, but in the traffic section as well. I am using Weebly and it seems hard to add ads.text file in it. I hope you have an idea of how it is done, or whether the ads.text has something to with my visit decrease. Thanks

  8. I’ve had an Adsense account for about 8 years. I first starting using Adsense when I created my first Classic Google site. Originally Adsense was built into the Classic Google sites editor. A few years later it was removed from the editor, but my Adsense ads continued to pay. I built a couple more Classic sites after that an added Adsense adds with the html insert option. This seemed to be fine with Google and the ads paid. I have seen comments suggesting that you are not allowed to use Adsense with Google sites. If that were the case, I’m sure Google would have terminated my account. I have since converted one of my Classic Google sites: https://www.streaminghawaii.com” to a New Google site. I have added new Adsense ads and they are still paying. I just got the message about the ads.txt file. My question is, “How do you ad this to a Google site”?

  9. HI,

    Thanks for this guide, I have faced this issue for a long time, Maybe it from June but now I fixed them.

    I think Google has started this update because most of the time, ads appear on irrelevant pages. We should take advantage of this ads.txt file because Google strongly recommended that Creating your own ads.txt file gives you more control over who’s allowed to sell ads on your site and helps prevent counterfeit inventory from being presented to advertisers.

    Cheers

  10. Do you have to have one? Technically no. However that could change soon. At the moment if you have any ads.txt file an advertising network will check if they are in there and if not, they probably won’t buy your traffic. If you don’t have an ads.txt file they carry on as normal.

  11. I think that what you posted made a great deal of sense.
    But, what about this? suppose you added a little information? I mean, I don’t wish to tell you
    how to run your website, however suppose you added something
    that makes people want more? I mean How to Create and Place an Ads.txt
    File for Your Website is a little plain. You might look at Yahoo’s home page and watch how they create post
    titles to get people interested. You might add a video or a related pic or two to grab people excited about
    what you’ve written. In my opinion, it could make your posts a little livelier.

  12. Hi. I am running a blog on Wix. Unfortunately, it is not as simple as on Wordpress to add a ads.txt file to the roots. I can see ads.txt for Google Adsense, that I installed through custom code that Wix provides for only Google adsense. However, I am using media.net and I don’t know how to either upload media.net ads.txt file or revise the one that is already there for google adsense. I need to add media.net advertisers. Any help would be greatly appreciated. Thanks

    1. I know nothing about Wix. I doubt it’s the optimal platform for a blog style site. It’s great for business sites I suspect but not blogs. Sorry, I can’t be more help.

Leave a Reply to Karen Cancel Reply

Your email address will not be published.

Scroll to Top