- 06 Mar
- Eric Hochberger
Ads.txt on SquareSpace and Other Hosted Platforms
On our quest to hit 100 percent Ads.txt adoption at Mediavine, we’ve hit some snags along the way with sites on closed, hosted platform systems such as SquareSpace, Shopify and Wix.
The Ads.txt spec requires that you upload a plain text file named ads.txt at the root of your domain. Example:
The issue with closed, hosted platforms like SquareSpace is that you don’t have the ability to upload a document to the root of your site.
Luckily, our partners at Google were able to update Blogger to support an ads.txt file, but on other similarly closed systems, we needed a workaround.
How did we fix it?
First, let’s look at a key aspect to the technical specs behind ads.txt.
Ads.txt must be implemented at the root domain.
Why is that so critical? Because most SquareSpace, Shopify, etc., sites are hosted at a www domain.
Why does that matter? Because we can host different content on the root domain versus the www subdomain. When a DSP comes looking for an ads.txt file, they’re automatically going to request it from the root domain, or:
Due to the standard, no DSP is going to request ads.txt from the www, so it doesn’t matter if we can or cannot upload an ads.txt file to our www site. No one ever checks that.
While we waited for SquareSpace and Shopify to offer a more permanent solution to their users, we created a custom temporary solution that used the fact that DSP’s serve an ads.txt file over root domain as the entire crux of the strategy.
If you are interested in the technical details of how we made that work …
The temporary solution was to take over hosting of the apex domain, (in our example http://thehollywoodgossip.com). If we were to see a request for ads.txt, we served it. All other requests to the naked domain were 301 redirected to the www subdomain (the regular SquareSpace site), and things continued to serve there as normal.
This was handled through a cloud-based hosting solution that we personally built using Digital Ocean. We needed something that could scale to hundreds of requests, support load balancing for redundancy, support free SSL certificates for secure sites on closed platforms, and, most importantly, something we could point A Records to.
That last one was a curveball thrown at us.
The issue there was that DNS records at the naked domain are limited to pointing to IP Addresses. While some DNS services such as DNSimple have workarounds using an ALIAS, we couldn’t rely on that when dealing with thousands of publishers and hundreds of domain name providers.
Luckily, Digital Ocean offers an IP Address-based Load Balancer that we were able to point the A Record to. That’s rare in Cloud-based hosting companies that also offer free SSL certificates (trust us, we looked around a lot).
This was never intended to be a long term solution here, just a nice way to bridge the gap for our publishers using a closed system.
If you are using SquareSpace (or other hosted platform) and need help implementing ads.txt
We have you covered! If you are using SquareSpace and would like to tackle this yourself, you can use this step-by-step help article.
Otherwise, please feel free to email email@example.com and our Support Engineers will be happy to assist you with making sure your ads.txt file is displaying correctly and is always up to date.
© 2020 Mediavine. All Rights Reserved.