Skip to content

Commit c1c0c86

Browse files
authored
Enhance bot tracking documentation in tracking-api.md
Expanded the documentation on bot tracking capabilities and parameters in Matomo, including details on request processing modes and specific parameters evaluated during bot tracking introduced with matomo-org/matomo#23725
1 parent 51c9090 commit c1c0c86

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

docs/5.x/tracking-api.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,52 @@ Note: the user of the HTTP API is responsible for determining the source locatio
183183

184184
## Tracking Bots
185185

186-
By default Piwik does not track bots. If you use the Tracking HTTP API directly, you may be interested in tracking bot requests. To enable Bot Tracking in Piwik, set the parameter `&bots=1` in your requests to `matomo.php`.
186+
As of Matomo 5.6.0, Matomo can record requests from automated agents so you can analyze bot activity separately from normal visits. The tracking distinguishes between **visit/action tracking** and **bot tracking**, depending on the `recMode` and detection results.
187+
188+
_Note: Currently the bot activity tracking is limited to user triggered AI Assistants, such as ChatGPT-User, Perplexity-User and others. Other bot requests will be detected, but discarded._
189+
190+
### How Matomo decides how to process a request
191+
192+
Matomo uses the optional `recMode` parameter to control how incoming requests are handled:
193+
194+
* **(not set)***Visit only*
195+
This is the default behavior for all tracking requests. Only normal visits and actions are recorded.
196+
Requests detected as bots are ignored unless explicitly overridden with `bots=1`.
197+
198+
* **`recMode=1`***Bot only*
199+
Only bot tracking is performed. If the request is not detected as a bot, it will be discarded.
200+
201+
* **`recMode=2`***Auto mode*
202+
Matomo automatically decides whether to treat the request as a bot or a normal visit based on detection.
203+
204+
### The `bots` parameter
205+
206+
`bots=1` can be used to **force a request to be tracked as a normal visit/action**, even if Matomo’s detection classifies it as a bot.
207+
This allows preserving visit data from known bots in special cases, such as when using automated testing or controlled monitoring tools.
208+
209+
_Note: This parameter exclusively works in *Visit only mode*, so with `recMode` not set_
210+
211+
### Parameters processed during bot tracking
212+
213+
When a request is processed as a bot (either via `recMode=1` or automatically detected in `recMode=2`), **only** the following parameters are evaluated.
214+
All other Tracking API parameters are ignored for bot requests.
215+
216+
* `url`: The page URL that the bot accessed.
217+
* `download`: The document URL if the request represents a download. To be sent instead of `url`.
218+
* `http_status`: The HTTP status code returned by your server.
219+
* `bw_bytes`: Bytes transfered to the client.
220+
* `pf_srv`: Server processing time in milliseconds.
221+
* `ua`: Full user agent string of the bot.
222+
* `source`: Source label for the bot request (for example `Cloudflare`, `Cloudfront`, `Wordpress` or a system tag).
223+
* `cdt`: Request date/time (if sending an explicit timestamp).
224+
225+
These fields are stored in Matomo’s bot tracking logs and used for analysis of AI crawlers and similar automated agents.
226+
227+
### Behavior summary
228+
229+
* Default (no `recMode`): only visit tracking is performed; bots are ignored unless `bots=1` is set.
230+
* `recMode=1`: only bot tracking is performed; non-bots are discarded.
231+
* `recMode=2`: automatic detection determines whether the request is tracked as bot or visit.
187232

188233
## Example Tracking Request
189234

0 commit comments

Comments
 (0)