春江暮客

春江暮客的个人学习分享网站

How to fix Google AdSense warnings about revenue loss risk due to ads.txt issues

2019-08-01 Miscellaneous
How to fix Google AdSense warnings about revenue loss risk due to ads.txt issues

Recently, AdSense kept showing a warning about revenue loss risk - you need to fix some ads.txt file issues to avoid serious income damage. Although it’s just a few cents, seeing this prompt still makes you want to properly resolve it, haha.
This is the kind of warning:

adsense
Here I share the correct approach to handle this issue.

1. First, download the ads.txt file from AdSense locally and upload it to your server.

Open it in the browser, you should see the ads.txt displayed correctly.
adsense_ads
At first, I thought this would solve the problem, but after a couple of days it was still there. At this point, the next step is troubleshooting.

2. Check main domain redirect settings

Google AdSense does not check only the www subdomain. It also checks the apex domain bobobk.com, while www.bobobk.com is just a subdomain. If the main domain does not redirect correctly, AdSense may fail to find the ads.txt file.
So the fix is simple: make sure bobobk.com properly redirects to www.bobobk.com.

2.1 Check CDN settings

My problem was a misconfigured CDN. Here’s the correct method for Cloudflare as an example. Choose your site, go to Page Rules, and set it as shown in the image below.
cf_301
Note that the URL ends with https://www.bobobk.com/$1 — do NOT forget the $1. Because of missing $1, Google could not fetch ads.txt from bobobk.com.

2.2 Check web server configuration

Here I use Nginx site configuration as an example.
Make sure to include both domain names in the server_name directive.

ng_inx_con

Finally, open ads.txt in the browser and confirm the correct content is returned. You can also verify the redirect and file response from the command line:

curl -I https://bobobk.com/ads.txt
curl https://bobobk.com/ads.txt

If both checks look correct, the warning usually disappears after AdSense rechecks the domain.

Summary:

Google AdSense usually shows this warning because it cannot reliably fetch ads.txt from the main domain bobobk.com. In practice, the key checks are the CDN redirect rule, the Nginx domain configuration, and whether the apex-domain ads.txt URL returns the expected content.

友情链接

其它