I recently encountered a problem on the Google AdSense portal. It showed that my site’s Ads.txt status was ‘Not found.’ I confirmed that I had placed the ads.txt file correctly at the root of my website.
However, when I tried to access this file using a web browser via https://cloudinfra.net/ads.txt, it displayed an error message: ‘Oops! That page can’t be found.
Table of Contents
What is ads.txt file?
The ads.txt (Authorized Digital Sellers) file is a simple text file that publishers in the digital advertising ecosystem use to publicly declare the companies or entities that are authorized to sell their digital advertising inventory. This file is placed on a publisher’s website and is meant to combat fraud and domain spoofing in programmatic advertising.
ads.txt file must be placed in the root directory of your website. The root directory is the top-level directory of your website, where all of your website’s files and folders are stored.
Error message when ads.txt is not found
You might come across an error message in the Google AdSense console that says, ‘Earnings at risk – You need to resolve some issues with your ads.txt file to prevent a significant impact on your earnings.’ You’ll have two options: ‘FIX NOW’ and ‘LEARN MORE.’
Let’s check where you can find Ads.txt file Status on Google Adsense portal:
- Login on Google AdSense portal.
- On the left-hand side, click on Sites.
- This will open up Manage your sites page that shows all your sites Integrated with Google AdSense.
- You can check your Site’s Approval Status and Ads.txt status as well.
As you can see in below screenshot, Ads.txt status column for my site cloudinfra.net shows as Not found. We need to fix this issue as soon as possible and make sure Ads.txt status remains Authorized.
- You can click on your site’s name link in the ‘Site URL‘ column and then select ‘Check for updates.’
- If Google cannot access your site’s ads.txt file using this URL: ‘https://<your site name>/ads.txt‘, you may receive following error message:
Couldn’t find an ads.txt file. We tried looking for cloudinfra.net/ads.txt but couldn’t find a file. Please make sure you have uploaded the file correctly and it is available to the Google Adsense crawler.
You may also find one of the following Ads.txt file status on your Google AdSense portal. Today, we’re concentrating on resolving the ‘Not found‘ error.
- Not found: No ads.txt file was found when the site was last crawled.
- Authorised: Your publisher ID was found in the site’s ads.txt file.
- Unauthorised: You publisher ID wasn’t found in the ads.txt file, and AdSense can’t show ads.
- Not applicable: Your publisher ID isn’t needed in the ads.txt file.
Steps to fix ads.txt not found Issue
I have faced this problem when I was using Cloudflare as a Content Delivery Network (CDN) for my website. I’m not completely certain about the exact cause, but it’s possible that Cloudflare restricts direct access to the files on my website as a security measure. However, I can guide you through the steps which helped me resolve this issue for me.
- Log in to your Cloudflare account where you’ve added your websites
- From the home page, locate ‘Workers & Pages.’ If you can’t find the home page, simply click on the Cloudflare logo.
- Click on ‘Overview‘ and then select ‘Create Worker.’
- If you don’t see the ‘Create Worker‘ option on the Overview page, click on ‘Create application,’ and you’ll find the ‘Create Worker’ option under it.”
- Give Worker a distinct name. For instance, I’ve used ‘cloudinfraadstxt‘ as the name. Then, click the ‘Deploy‘ button to initiate the deployment of the Worker.
- As shown in the screenshot below, the Worker has been successfully deployed. Now, click on the “Configure Worker” button.
- After you’ve clicked on “Configure Worker,” proceed by clicking the “Quick edit” button.
- Start by selecting all the default code in the Worker.js file and deleting it. Then, replace that deleted code with the provided code below.
- Make sure to substitute ‘Add your Google AdSense / third-party Publisher ID info‘ with your actual Google AdSense Publisher ID.
async function handleRequest(request) { const init = { headers: { 'content-type': 'text/plain', }, } return new Response(adstxt, init) } addEventListener('fetch', event => { return event.respondWith(handleRequest(event.request)) }) const adstxt = `Add your google adsense / third party Publisher ID info`;
- Code has been replaced and I have added my site’s google publisher ID Information between the quotes.
- Now, on the right-hand side, click the “Send” button. You should observe a status code of 200. Finally, click on “Save and deploy” to deploy this application.
- Click on Save and deploy button again.
- On your Cloudflare dashboard, navigate to “Websites,” and then click on the name of your website on the home page.
- On the left-hand side options, select “Worker Routes,” and then click on the “Add route” button from the Worker Routes page.
- In the “Route” option, enter the URL for the ads.txt file, for example: https://cloudinfra.net/ads.txt. You can replace “cloudinfra.net” in the path with your site name.
- Worker Route has been successfully added.
Checking ads.txt File Access via a Web Browser
You can now test to see if you can access the ads.txt file using a web browser. As shown in the screenshot below, the ads.txt file is now accessible.
- Next, visit the Google AdSense portal and click on “Sites” in the left-hand side panel. On the “Manage your sites” page, you will find your site listed with an Ads.txt Status Issue. Click on the site to open a page where you can test for the ads.txt file.
- Click on the “Check for updates” link to verify if Google can now access the ads.txt file for your site.
- As you can observe, Google has successfully located the Ads.txt file.
- Furthermore, if you go back to the “Sites” section and check the Ads.txt Status, it should now be listed as “Authorized.”