Installation #
To install CrawlerDetect, follow these steps:
- Download & unzip the file and place the
crawlerdetect
directory into yourcraft/plugins
directory - Install plugin in the Craft Control Panel under Settings > Plugins
- 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; +http://help.soso.com/webspider.htm)') %} .. {% endif %}
Output the name of the bot that matched (if any)
{% set matches = craft.crawlerDetect.getMatches() %}
Credits #
CrawlerDetect by Mark Beech.
Releases
- Added: Initial release
Currently available for Craft consulting and custom plugin development
Contact me