Adsense. How to add ads.txt file to Shopify

From the moment you set up Google AdSense on a Shopify site, a short time will pass until you get notified to add an "ads.txt" file to the root of your website or your revenue will be greatly affected. 

Seems like an easy task, but as soon as you get the file from AdSense you will notice there is no way to upload it to Shopify and be accessible at the root of the website ( https://website_url/ads.txt ).

There is, however, a workaround for this issue.  To make it work just follow these steps:

  • Log in to your shopify admin and go to settings > files
  • Upload the "ads.txt" file and copy the asset url
  • Go to Online Store > Navigdation > URL Redirects
  • Create a new redirect rule
  • From -> /ads.txt
  • To -> previously copied asset url

Ads.txt file uploaded to files


Ads.txt redirect rule


By creating this redirect rule, the file is now accessible at the root url, thus getting rid of the warning.

It will take time for Google to stop showing this warning, it will not be instant, but it is the only working solution.

Leave a comment

Please note, comments need to be approved before they are published.