How to Add an ads.txt File for Google AdSense to Your Shopify Store

How to Add an ads.txt File for Google AdSense to Your Shopify Store

aop3d tech

How to Add an ads.txt File to Shopify

Ensure only approved sources display ads on your site. Since Shopify doesn’t provide direct access to your root directory, use this redirect method to satisfy Google AdSense.

Step 1: Download ads.txt from Google AdSense
  1. Log in to your Google AdSense account.
  2. Look for any alerts on your homepage (click "Fix now") or go to the Sites tab.
  3. Click the down arrow to expand the "Create an ads.txt file for [your site]" section.
  4. Click Download to save the file to your computer.

Do not edit the contents of this file, as it contains important authorization details.

Step 2: Upload the File to Shopify
  1. Log in to your Shopify admin panel.
  2. Click Settings in the lower-left corner, then select Files.
  3. Click Upload files and select your downloaded ads.txt file.
  4. Once uploaded, copy the URL of the file.
📌 Example:
https://your-store.myshopify.com/cdn/shop/files/ads.txt
Step 3: Create a Redirect
  1. Go to Online Store > Navigation in your Shopify admin.
  2. Click View URL Redirects, then Create URL Redirect.
  3. In the Redirect from field, enter the exact path below:
/ads.txt
  1. In the Redirect to field, paste the long Shopify Files URL you copied in Step 2.
  2. Click Save redirect.
Step 4: Verify Your Setup
  1. Open a new browser window or incognito tab.
  2. Type yourstore.com/ads.txt into the address bar and press Enter.

If the page displays a plain text screen with your AdSense publisher ID, your setup is correct!

⚠️ Note: It may take Google AdSense up to 24 hours to crawl your site and recognize the file.

Happy monetizing! Your Shopify store is now safely configured for Google AdSense.

Back to blog

Leave a comment

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