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.



What do you think? Leave a comment!

  • Paul Williams says:

    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’?

  • Anne says:

    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.

  • David says:

    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

    • Jon says:

      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.

  • R says:

    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

    • Jon says:

      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).

  • Karen says:

    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?

  • Winda says:

    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..

  • >