Skip to content

Detect Google-GeminiNotebook as an AI bot - #153

Merged
sgiehl merged 2 commits into
matomo-org:masterfrom
eldk:master
Jul 27, 2026
Merged

Detect Google-GeminiNotebook as an AI bot#153
sgiehl merged 2 commits into
matomo-org:masterfrom
eldk:master

Conversation

@eldk

@eldk eldk commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Description

Google renamed the Google-NotebookLM User-Agent token to Google-GeminiNotebook.

The PHP tracker currently recognizes the former Google-NotebookLM token but does not recognize the new Google-GeminiNotebook token. As a result, MatomoTracker::isUserAgentAIBot() returns false for requests using Google's current User-Agent, and doTrackPageViewIfAIBot() does not track them.

This change:

  • adds Google-GeminiNotebook to AI_BOT_USER_AGENT_SUBSTRINGS;
  • keeps Google-NotebookLM for backward compatibility during the transition;
  • adds test coverage for Google's current full desktop User-Agent;
  • adds test coverage confirming that the former Google-NotebookLM token remains supported.

Expected behavior:

Google-GeminiNotebook -> AI bot: true
Google-NotebookLM     -> AI bot: true

No bot-name normalization is required in this repository because isUserAgentAIBot() only returns a boolean. Normalization to the historical Google-NotebookLM name is handled by Matomo core and Device Detector.

Related work:

Google documentation:

https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers#gemini-notebook

Checklist

  • [✔] I have understood and reviewed all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rules

Review

Validation

Unit tests were added for both the current and former User-Agent tokens.

The repository test suite has not yet been run locally.

@sgiehl sgiehl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@sgiehl
sgiehl merged commit b3e57c4 into matomo-org:master Jul 27, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants