Utility · Personal
Facets antibot
A Drupal module that hides facet links from AI training bots by building URLs in JavaScript. Traffic on one site fell from 10 million visits a week to 50,000.
This is a small Drupal module I built to address a growing problem: sites using complex facets on Solr search are getting slammed by AI training bots. The pattern is this: a site features multiple facets to help filter search results (using Search API). When AI bots hit those pages they systematically click every possible combination of checkboxes to try to uncover content to ingest. Even if there are only a few hundred or a few thousand nodes on the site, these bots will attempt millions of searches. Essentially, it's an unintended honeypot for AI bots.
The reason this is possible is because of the way the Facets module is architected. Each checkbox contains a link in the DOM to the page that will be loaded if that checkbox is clicked. Since the DOM contains all of these links, it's very easy for the AI bot to follow every single one, and then follow the refining links that occur on those pages.
My fix was to remove paths from the DOM. This means calculating the page URL in JavaScript based on which checkbox the user clicks. Since very few AI bots run a full JavaScript stack (Google's Gemini crawler being a notable exception, since it runs headless Chrome), the page contains no links that are visible to the bots.
Before I deployed this module on one of our sites we were getting 10 million visits per week. Immediately after deploying it that dropped to 50,000 visits per week. Ordinarily it would seem counterintuitive to crow about a module massively reducing traffic to a site! However, in this case, it was a clear win.
Produced at Clarity Innovations.