How to add Ads.txt in the NextJS project to fix the AdSense alert?

Fixing the Ads.txt warning in Google adsense NextJS project

How to add Ads.txt in the NextJS project to fix the AdSense alert?

In a new website, once Google AdSense approves the website for Ads, getting the below warning message to add “Ads.txt” is very common. In this article let's see how “Ads.txt” can be added to a NextJS project.

What is Ads.txt?

Below is the definition from the AdSense link

Authorised Digital Sellers or ads.txt is an IAB Tech Lab initiative that helps ensure that your digital ad inventory is only sold through sellers (such as AdSense) who you’ve identified as authorized.

How to fix Ads.txt issue?

  1. create ads.txt in the root path of the NextJS project.

    touch ads.txt // note the case of ads.txt file

  2. Sign in to your AdSense account.

  3. Click “Sites” on the sidebar

  1. Select the site with the ‘Not found’ ads.txt status.

  2. Here you can get the contents required for the “Ads.txt” file, copy and paste them into the file.

  1. In the “ads.txt” file, we can add not only the Google AdSense details but also other Ad networks can also be added.

  2. Upload your ads.txt file to the root directory of your site.

  3. To verify that you published your file correctly, check that you successfully see your file’s content when you access the ads.txt URL (example.com/ads.txt) in your web browser. If you can see the file in your web browser, it’s likely that AdSense will successfully find it.

  4. If you are already using Google Search Console, submit the path of “ads.txt” in the “URL Inspector” to expedite the crawling.

  5. It would take at least 7 days for AdSense to crawl and verify the “ads.txt” file. In a few days, the site status would be updated like below

You are all set! Happy Earning 💰💲


Visit https://quizessforyou.com for programming quizzes.

Did you find this article valuable?

Support quizzesforyou by becoming a sponsor. Any amount is appreciated!