How to Add an ads.txt File for Google AdSense in HubSpot

If you're monetizing your site with Google AdSense, you might see a prompt asking you to add an ads.txt file. This file is essential for authorizing who can sell ads on your site and improving transparency in programmatic advertising.

In this article, we’ll walk you through the simple steps to create and upload an ads.txt file, with special notes for HubSpot CMS users.


What is an ads.txt file?

ads.txt stands for Authorized Digital Sellers. It’s a plain text file created by the Interactive Advertising Bureau (IAB) to prevent ad fraud. It tells buyers which advertising platforms are allowed to sell your digital ad inventory.

Each line in the file typically looks like this:

google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0

Replace pub-0000000000000000 with your actual Google AdSense Publisher ID.


Step-by-Step: How to Add ads.txt

1. Create the File

  • Open a text editor (Notepad, VS Code, etc.)
  • Paste your AdSense entry (example above)
  • Save the file as ads.txt (all lowercase)

2. Upload the File

To be valid, the file must be accessible at:

https://www.yourdomain.com/ads.txt

This means you need to upload it to the root directory of your site.


For HubSpot CMS Users

HubSpot’s file manager doesn't place files in the root directory by default, so a workaround is needed:

  1. Go to Marketing > Files and Templates > Files
  2. Click Upload File, and upload your ads.txt
  3. Copy the hosted URL (e.g., https://yourdomain.com/hubfs/ads.txt)
  4. Set up a URL redirect from /ads.txt to the uploaded file's path

Note: If you are on a CMS Hub Enterprise plan, you can use the HubSpot URL Redirects tool to do this.

If you're unsure, contact HubSpot support and ask how to set a redirect from /ads.txt to your uploaded file.


How to Check if ads.txt Is Working

After uploading and redirecting:

  1. Open your browser and go to https://yourdomain.com/ads.txt
  2. You should see the exact line(s) from your file
  3. You can also validate it using free tools like ads-txt.live

Final Tips

  • Only add sellers you trust (Google AdSense, SSPs, etc.)
  • Keep your ads.txt file updated as your monetization partners change
  • Incorrect ads.txt files can block ads from showing, so double-check formatting

Adding an ads.txt file is a small but important step to ensure ad transparency and protect your revenue. It takes just a few minutes, but has a lasting impact.