Use CrawlerDetect to detect 1.000's of bots/crawlers/spiders in Craft.

Installation #

To install CrawlerDetect, follow these steps:

  1. Download & unzip the file and place the crawlerdetect directory into your craft/plugins directory
  2. Install plugin in the Craft Control Panel under Settings > Plugins
  3. The plugin folder should be named crawlerdetect for Craft to see it.

CrawlerDetect works on Craft 2.4.x and Craft 2.5.x.

Overview #

The CrawlerDetect library is a PHP class for detecting bots/crawlers/spiders via the user agent and http_from header. Currently able to detect 1,000's of bots/spiders/crawlers.

Using #

Detect if bot/crawler:

{% if craft.crawlerDetect.isCrawler() %} .. {% endif %}

Pass a user agent as a string:

{% if craft.crawlerDetect.isCrawler('Mozilla/5.0 (compatible; Sosospider/2.0; +') %} .. {% endif %}

Output the name of the bot that matched (if any)

{% set matches = craft.crawlerDetect.getMatches() %}

Credits #

CrawlerDetect by Mark Beech.


1.0.0 — 2017-04-24 Download
  • Added: Initial release

Currently available for Craft consulting and custom plugin development

Contact me