In this guide I'll show you how to fix the infamous “Earnings at risk – One or more of your sites does not have an ads.txt file. Fix this to avoid severe impact to your revenue.” message in Google AdSense for your Squarespace website.
Now I'm already assuming that you've set your website up in AdSense, verified your domain and passed the review process so that you're ready to show ads.
What is ads.txt?
Well no one seems to know, but according to DIGIDAY it's an IAB-approved text file that aims to prevent unauthorized inventory sales.
What does that mean?
No idea, but what we do know is that not having it configured properly can have an impact on your earnings. We know that because the error message says things like "Earnings at risk" and "Fix this to avoid severe impact to your revenue.”
What do we need to do to fix this then?
Basically when Google's AdSense bots visit your domain with the URL slug of /ads.txt at the end, so for example https://yourdomainname/ads.txt they need to see the ads.txt file that contains your publisher ID as well as a couple of other bits on information.
Step 1 - Make The ads.txt File
Really simple this one. Open TextEdit on Mac, or NotePad on PC and copy and paste the following:
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
Then replace "pub-0000000000000000" with your own publisher ID. You can get instructions on how to find your publisher ID here.
And save your file naming it 'ads' with the file extension of .txt
Hint: To save as .txt on Mac, while in TextEdit click the "Format" menu then select "Make Plain Text" and then save.
NOTE - you can also download your ads.txt by clicking 'Learn More' in the error message bar in your Google AdSense account.
Step 2 - Upload the File to Squarespace
Over in Squarespace click to edit a page. Any page will do because this part is only temporary to upload the ads.txt file.
Add a Text Block to the page
Once you've added the Text Block stick some text in it. Anything will do. Then highlight the text and hit the link button.
Then click on the cog icon to bring up the link settings.
Under the link settings select 'File' and then 'Upload File'.
Once the file is uploaded click on the file so that it is checked and then hit Save.
You'll then be prompted again to hit Apply on the link block
Then save the changes to your page.
Step 3 - Getting the Link
Next we need to grab the URL of the ads.txt file that we've just uploaded. We can do that by hovering and right clicking over the text that we just added, then click on 'Copy Link Address'.
Step 3, done!
Step 4 - Setting Up The Redirect
In your side menu in Squarespace make your way to 'Settings > Advanced > URL Mapping'.
Then add the following:
/ads.txt -> YOURURL 301
Replacing YOURURL with the link we copied in step 3.
Your URL map should look something like this:
Hit 'Save', and that's it, we're done. You can now go and remove the temporary text we added in step 2.
You can test the redirect by visiting your website followed by /ads.txt, so for example https://yourdomainname/ads.txt.
If the file starts downloading when you visit the URL then it's all good to go and there's nothing else you need to do. Next time AdSense crawls your site it will pick up the file and you'll stop getting the error.
Please note though, it can take anything from a couple of hours to a couple of weeks for AdSense to crawl your site, so you may still get the error for a little while afterwards.