By default, Matomo only tracks visitors with Javascript enabled. In the past, most bots did not execute JavaScript, but advanced bots now have the capability. Learn more about excluding new bots from being tracked.

However, there are scenarios where tracking bots can be useful, for example:

  • Track bots like Googlebot or Bingbot to understand how search engines interact with your site.
  • Detect unusual activity from malicious bots or scrapers, and take preventative action.
  • Assess how much server bandwidth and resources are consumed by bot traffic.

In Matomo, you can adjust bot tracking based on your specific needs. There are a few different ways to enable bot tracking, depending on how you track users in Matomo.

Track Bots with Matomo Tag Manager

In Matomo Tag Manager, you can enable bot tracking through the Matomo Configuration Variable. This variable is used to manage Matomo tracking settings.

  • To include bot visits in your analytics, simply enable the Track bots option in the Matomo Configuration Variable.

You can also configure custom rules in your setup, for example, to flag requests with certain headers, IP ranges, or specific behaviours as bot traffic. Create custom rules in Matomo Tag Manager using a variable, trigger, and tag.

  1. In Matomo Tag Manager, define a Variable (e.g., Custom JavaScript Variable) to check for bot-related attributes like specific user-agent strings.
  2. Create a Trigger that fires when the variable meets your bot criteria.
  3. Apply this trigger to a Matomo Analytics Tag for tracking.

Other Methods to Track Bots

There are a few options to track bots and search engine bots depending on how you track users in Matomo:

Using an Image Tracker

If you want to track bots that don’t execute JavaScript, you can add an Image Tracker to your pages. To activate the tracking for bots, add &bots=1 to the image URL. Learn more in How do I enable tracking for visitors when JavaScript cannot be used on a page (such as bots)?.

Using the JavaScript Tracker

If you’re using the Javascript Tracker and you want to track the Javascript-enabled bots only, add the following line in your tracking code: _paq.push(['appendToTrackingUrl', 'bots=1']);.

Using the Tracking HTTP API

If you’re using the Tracking HTTP API, you can enable the tracking of bots by setting the parameter &bots=1 in the matomo.php tracking request.

Importing Web Server Logs

If you’re importing your web server access log files, use the option --enable-bots in the tool to enable tracking of all bots.

See also: Why do Matomo data reports differ from Google Analytics and other analytics tools?

Previous FAQ: What does “Keyword not defined” mean in the Referers > Search Engines keywords report?