opibility

Call Us @

317.732.5185

Email Address

info@opibility.com

ops blog

How to add Google Adsense’s ads.txt file to Shopify

Adding the ads.txt file to your Shopify store for Google AdSense involves a few steps. This file helps prevent unauthorized digital ad sales, which is essential for maintaining the integrity of your ad inventory. Here’s a step-by-step guide on how to do it:

Step 1: Create the ads.txt File

  1. Open a text editor (such as Notepad on Windows or TextEdit on Mac).
  2. Add your Google AdSense publisher ID in the following format: google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
    (Replace pub-0000000000000000 with your actual AdSense publisher ID.)
  3. Save the file as ads.txt.

Step 2: Add the ads.txt File to Shopify

Since Shopify doesn’t allow direct access to the root directory, you need to use a workaround by creating a URL redirect that points to your ads.txt file stored in your theme’s assets.

Using the Shopify Admin

  • Upload ads.txt to Your Theme Assets:
    • Go to your Shopify admin and navigate to Online Store > Themes.
    • Click on Actions > Edit Code for your current theme.
    •  In the left sidebar, find the Assets folder and click on Add a new asset.
    • Upload your ads.txt file here.
  • Create a URL Redirect:
    • In the Shopify admin, go to Online Store > Navigation.
    • Click on URL Redirects.
    • Click Create URL redirect.
    •  In the Redirect from field, enter /ads.txt.
    • In the Redirect to field, enter the URL of the ads.txt file you uploaded. This URL typically follows the format:  /assets/ads.txt
    • Click Save redirect.

Step 3: Verify the ads.txt File

  1. Open a browser and go to https://yourstorename.com/ads.txt.
  2. Ensure the content of the ads.txt file displays correctly.

Additional Tips

  • Monitor Regularly: Check regularly to ensure your ads.txt file is accessible and up to date, especially if you make changes to your ad partners.
  • Multiple Ad Networks: If you work with multiple ad networks, include all relevant entries in the ads.txt file, each on a new line.

By following these steps, you’ll ensure that your `ads.txt` file is properly set up on your Shopify store, helping to secure your ad revenue and comply with industry standards.

Closeup of the url bar in a browser

Blog Categories: