Add method to track an AI bot request, if the current user agent is a known AI bot - #148
Conversation
Co-authored-by: Thomas ZILLIOX <thomas@zilliox.me>
|
@matomo-org/core-reviewers please review this. |
sgiehl
left a comment
There was a problem hiding this comment.
AI bot tracking review
Reviewed the branch against what Matomo core (core/Tracker.php) and the BotTracking plugin actually read/expect (cross-checked with two independent passes + the server's own integration tests and BotDetector).
What matches correctly: the recMode=1 semantics (bot-only recording), and the http_status / bw_bytes / pf_srv / source parameter names — all four are read by BotRequestProcessor, and source is genuinely supported (used by VisitorGenerator). 6 of the 7 UA substrings match BotDetector's AI-chatbot patterns exactly.
Blocking / should-fix before merge:
- Blocker — the unit suite is red: the
Devinrow still expectstrueafter Devin was removed from the list (inline). - Major —
GPTBotis in the client list but the server'sBotDetectordoesn't recognize it, so those requests are accepted but recorded nowhere (silent data loss) (inline).
Minor (worth doing in the same pass, both cause silent data loss): !empty() drops valid 0 telemetry, and source isn't truncated to the server's VARCHAR(50) (inline). Plus PHPDoc/return-contract fixes (inline).
Not inlined (low priority):
- No test exercises
doTrackPageViewIfAIBot()itself (matched + unmatched paths), no zero-value boundary test, and there's no positiveGoogle-NotebookLMcase in the provider. - Unrelated indentation churn at lines ~922, ~1427, ~2022 (formatter over-indentation of continuation params) — revert to keep the diff focused.
Inline comments include ready-to-apply suggestions.
Co-authored-by: Stefan Giehl <stefan@matomo.org>
Description
Changes:
Checklist
Review