search spam

Magento search spam is caused by automated bots that send thousands of meaningless queries, thus creating large numbers of search result URLs. This bot abuse wastes Magento server resources and your crawl budget on low-quality URLs.

The Magento 2 Search Spam filter helps you prevent this by blocking specific search queries usually used by bots to generate multiple search results pages. 

In this guide you'll learn how to identify search spam in Magento, understand how it influences your SEO and learn how to block bots from using search according to Magento security best practices.

Key takeaways
  • Magento 2 search spam appears when bots repeatedly send automated queries to Magento product search, generating thousands of unnecessary requests and search result URLs.
  • To find spammy search queries in Magento, use server log or Google Search Console > Crawl Reports.
  • To fix search spam in Magento, use the search spam filter from Magefan's Bot and Spam Blocker for Magento. It allows merchants to block specific search queries known to be used by bots while keeping Magento search enabled for real customers.
  • Other methods to stop search spam include IP blocking, user-agent restrictions, URL restrictions, and reCAPTCHA.

What Is Magento 2 Search Spam?

Magento 2 search spam is an automated use of Magento product search by bots that usually includes irrelevant keywords or repeated search patterns in order to create thousands of search results URLs. Instead of searching for a product e.g. black tee, a bot may send random queries, causing Magento to process the search results and return a new search results page.

magento search spam

Example of the same search queries being sent from the same IP multiple times within 2 hours (source: Magefan Bot Blocker)

What does spam in Magento product search look like?

Common spam search requests include gibberish or irrelevant keywords, which can be easily recognised. The most common signs of search spam include:

  • Thousands of unique search results URLs appearing in server logs
  • Search queries real customers are unlikely to use: gibberish, irrelevant terms
  • Large number of requests from the same IP or user agent
  • Sudden increase in search requests without a corresponding increase in customer activity

Why is Magento search spam a problem?

Search spam caused by bots is not only a server resources problem. It affects different areas of your store, from user experience to SEO:

  • URL growth: each search query creates a unique URL with no value to the store, bots create thousands of them, causing spam.
  • Server performance: each search request requires Magento to process the query and return a URL, which consumes server resources and makes your store slower for real users.
  • Crawl budget: each search results URL is considered unique by search crawlers, so they waste your crawl budget visiting and discovering low-quality URLs.
  • Analytics: automated search requests make traffic and search reports harder to interpret and use for marketing purposes.

To fix search spam in Magento, you don't need to disable Magento search, you just need to prevent bots from using abusive search queries and spamming the search.

You can identify search spam in Magento by looking for high volumes of search result requests, unusual search queries, and repeated automated traffic that doesn't match user behaviour in Google Search Console, server logs, or bot traffic reports.

Check your server logs

If you are a developer, the easiest way to check spam in Magento product search is to look for repeated requests to Magento search endpoints in server logs. Compare IP addresses, user agents, search terms, request frequency and time.

e.g. hundreds of different search queries from the same IP address over a short period of time is most likely automated behaviour.

Check Google Search Console

Check whether search results URLs are being discovered and crawled in the Google Search Console. Navigate to Settings and open the Crawl Stats report. Then open the report by file type > HTML and search for URLs that contain /catalogsearch/result/ or your custom search results path. Look for unexpected search results queries and investigate if they're generated by real users.

Pro tip: if you find search results URLs in Google Search Console crawl reports, it's best to block them from crawling and indexing to avoid duplicate content and thin pages. You can use Magento NOINDEX NOFOLLOW tags for that.

htmls craw requests google search console

Finding search results URLs in Google Search Console crawl reports

Use bot traffic reports

Magento doesn't provide bot traffic reports by default. But if you're using tools like Magefan Bot Blocker, you can see unusual search results frequency, IP addresses and user agents and identify patterns. 

The bot blocking solution already blocks common search spam patterns. However, you can identify recurring queries and extend the search spam filter rules.

How to Stop Search Spam in Magento?

The simplest way to stop search spam in Magento is using the search spam filter available in the Magefan Bot Blocker Extension. It blocks known spammy search queries bots use to generate unnecessary search results URLs by default. This filter blocks specific queries to keep product search enabled for real users instead of disabling it entirely.

To stop Magento 2 search spam, follow these steps.

Step 1: Identify spam queries

If you've identified some search spam in your server logs or Google Search Console, create a list of unusual or repeated search requests that have clearly been automated. 

Step 2: Enable search spam filter in Magento

Navigate to  Stores > Configuration > Magefan Extensions > Bot Blocker > Search Filter, enable it, and add your spammy search queries to the built-in list. Try to avoid using overly broad keywords that could match legitimate product searches. Don't forget to save the settings.

enable search spam filter in magento

Magefan Search Spam Filter settings

Step 3: View blocked search queries

Navigate to Systems > Bot Blocker> Traffic Monitor and monitor how the applied search spam filter works. Look for the Top paths reports to spot /catalogsearch/result/ requests. 

top magento paths requested by bots

Search spam tracker in Magefan bot blocker

For deeper research, you can scroll down to the Raw logs and use and Advanced filter to find IP addresses, countries and user agents that abused your search requests and were blocked. 

magento search spam

Blocked search spam in Magento

Magento Search Spam Filter vs. Other Bot Blocking Methods

The main goal of the Magento spam filter is to block bots from using abusive search queries and generating thousands of search results pages. However, sometimes bots don't use suspicious queries, they send high volumes of the same search requests from the same IP, or a high number of requests within a short period of time.

That's why, to prevent search spam in Magento, you need to explore other bot-blocking methods depending on the nature of the automated traffic.

  • Search filter: targets suspicious search terms submitted through Magento product search.
  • IP blocking: targets sources (IP addresses or ranges) that generate malicious traffic repeatedly.
  • User agent blocking: targets crawlers, bots and scrapers identified through suspicious activity or requests.
  • Rate limiting (DDoS protection): targets user agents that exceed a certain number of requests that is identified as malicious and automated. 
  • URL restrictions: targets bots trying to access URL patterns they are not allowed to visit. 
  • reCAPTCHA challenges: creates verification for users with suspicious behaviour instead of blocking requests or IP addresses.

Magefan Bot Blocker combines all of these approaches, providing settings for IP access lists, DDoS protection, user-agent rules, URL pattern restrictions, and CAPTCHA together with the search spam filtering. This allows you to protect your store from unwanted bot activity through muliple blocking methods.

Method Best for Main purpose
Search spam filter Abusive search queries Stop unwanted search results URL generation
IP blocking Malicious IPs Block specific traffic addresses and countries
User agent blocking Bots and scrapers Block automated bots
Rate limiting High server requests Control excessive server requests
URL restrictions Specific URL patterns Block bots from accessing specific URLs
reCAPTCHA Suspicious traffic Verify if visitors are humans

All of these methods work together to block unwanted traffic. For example, if the bots use search queries not blocked by the search filter, the rate limiting will still block excessive requests from the same IP or enable CAPTCHA in Magento for suspicious visitors.

FAQs

How to block spam search queries in Magento 2?

collapsible icon
To block spam search queries in Magento, identify the suspicious search terms likely submitted by bots through the server logs or Google Search Console. Then use the Magento 2 search spam filter from Magefan Bot Blocker to block bots from generating search spam URLs.

How to restrict certain search keywords in Magento?

collapsible icon
Magefan Magento Search Spam Filter already blocks known spam keywords from Magento product search while keeping regular search terms available for real customers.

Does Magento search spam hurt SEO?

collapsible icon
Magento search spam hurts SEO indirectly by wasting your crawl budget and preventing search crawlers from prioritising and discovering more important pages. Search bots create thousands of low-quality URLs, requested repeatedly, which can slow down the website experience for real users.

Should I block all Magento search bots?

collapsible icon
You should block search bots in Magento only if you see abusive search queries or a suspicious amount of queries from specific IPs, while keeping your search accessible for trusted user agents and search crawlers.