AI chatbots retrieve website content through HTTP requests and typically do not execute client-side JavaScript embedded in the page. This means their activity cannot be captured using the standard Matomo JavaScript tracker (matomo.js).

To track AI chatbot activity, you need an integration that detects these requests and sends the relevant data to Matomo.

Setup requirements

  1. The Cloudflare and Amazon CloudFront integrations require technical knowledge and access to your website’s infrastructure.
  2. You will need to configure and deploy a Cloudflare Worker or AWS Lambda function.
  3. If you are unfamiliar with these technologies, we recommend involving your website developer or administrator.

The method you use depends on your website’s infrastructure and how incoming requests are handled. Choose an integration that matches your website’s infrastructure:

If your website uses multiple supported platforms, use only one integration to avoid recording the same AI chatbot request more than once.

This guide explains how to set up AI chatbot tracking using Cloudflare or Amazon CloudFront.

How AI chatbot telemetry works in Matomo

AI chatbot telemetry uses the standard Matomo tracking endpoint (matomo.php) but follows a dedicated processing path. When a request is detected from an AI chatbot:

  • No visitor or session is created.
  • No visit attribution logic is executed.
  • No data is written to visit-related tables such as log_visit or log_link_visit_action.
  • Telemetry data is stored in dedicated chatbot telemetry tables.
  • URLs are resolved through log_action without performing visit lookups.

This behaviour is automatic and does not require additional configuration once telemetry requests are sent.

Supported AI chatbots and detection rules

Matomo detects AI chatbots based on User-Agent substring matching to ensure AI chatbot traffic is always processed separately from human visits. A request is classified as a chatbot when its User-Agent contains one of the following substrings (minimum supported list):

ChatGPT-User
MistralAI-User
Gemini-Deep-Research
Claude-User
Perplexity-User
Google-NotebookLM

Detection cannot be overridden and requests identified as AI chatbots are always processed in no-visit mode.

Set up AI Chatbot tracking

AI chatbot reports only collect data after setting up chatbot tracking. If you open an AI chatbot report and see a No data collected message, you will need to configure chatbot telemetry for your environment.

  1. In Matomo, click on AI Insights in the top right menu.
  2. Open an AI Chatbots report, for example AI Chatbots Overview.
  3. Where an AI chatbot report shows no data has been collected, click the link Set up AI Chatbot tracking now.
    open ai insights to view ai chatbots report
  4. Choose the Cloudflare or Amazon Cloudfront method to access the setup instructions.
  5. Selecting a tracking method in Matomo does not install or activate the integration.
  6. Complete the deployment and configuration steps in your Cloudflare or AWS environment (described below).

Install with Cloudflare

This integration uses a Cloudflare Worker to detect AI chatbot requests and send tracking data to Matomo. A Worker is a serverless application that processes website requests through Cloudflare’s network.

The Matomo Cloudflare Tracker works with websites hosted by Cloudflare or another hosting provider, provided their traffic passes through Cloudflare.

Set up Matomo Cloudflare Tracker

The Worker uses two required configuration variables: MATOMO_URL and MATOMO_SITE_ID. There are other optional settings that let you control which requests are tracked, exclude specific URLs and configure logging.

Step 1: Check the requirements

To set up AI chatbot tracking with Cloudflare, you will need the following:

  • A Cloudflare account with permission to deploy Workers and configure website routes.
  • A website configured to route traffic through Cloudflare for live tracking.
  • Your Matomo URL and the site ID of the website you want to track.
  • Node.js 24 or later.
  • Access to a terminal, such as PowerShell.

Step 2: Download the Cloudflare Tracker

  1. Open the Matomo Cloudflare Tracker repository.
  2. Clone or download the repository and extract its contents.
  3. Open a terminal in the project folder containing package.json.
  4. Run npm install to install the project dependencies.

Step 3: Configure the Cloudflare Tracker

  1. Open the wrangler.toml file in a text editor.
  2. In the [vars] section, add your MATOMO_URL and your MATOMO_SITE_ID.
  3. Use the base URL only and do not append /matomo.php.
[vars]
MATOMO_URL = "https://your-matomo.example.com"
MATOMO_SITE_ID = "1"

The Worker includes default rules for supported AI chatbot User-Agents and excluded URLs. See the optional configuration settings if you need to customise these rules.

Step 4: Test locally (optional)

You can test the Worker against an existing website before deploying it to Cloudflare. Follow the repository’s local testing instructions.

Step 5: Deploy the Worker to Cloudflare

After configuring the Worker, deploy it to Cloudflare and assign it to your website’s traffic.

  1. Open wrangler.toml and confirm that your production Matomo URL and site ID are correct.
  2. Configure the Cloudflare zone and route in wrangler.toml according to the Cloudflare Tracker deployment instructions. The route determines which incoming website requests the Worker processes.
  3. In your terminal, run the following and check the terminal output to confirm that Wrangler deployed the Worker successfully.
  4. In Cloudflare, confirm that the Worker is assigned to the intended website route.
npx wrangler deploy

Important: Deploying the Worker does not automatically mean it is processing your website traffic. The Worker must be assigned to the correct route.

Follow the verification steps to confirm that AI chatbot requests are being tracked.

Install with Amazon CloudFront

This integration uses AWS Lambda to process Amazon CloudFront access logs and send AI chatbot tracking data to Matomo. AWS Lambda is a serverless computing service that runs code in response to events.

When CloudFront delivers access logs to an Amazon S3 bucket, the Lambda function processes the log files and identifies supported AI chatbot requests.

Set up Matomo CloudFront Tracker

The Lambda function uses two required configuration variables: MATOMO_URL and MATOMO_SITE_ID. Other optional settings let you control request filtering, batch processing, timeouts and logging.

Step 1: Check the requirements

To set up AI chatbot tracking with Amazon CloudFront, you will need:

  • An AWS account with permission to configure CloudFront, S3, Lambda and IAM permissions.
  • A website served through an Amazon CloudFront distribution.
  • CloudFront standard access logging configured to deliver compressed log files to an Amazon S3 bucket.
  • Your Matomo URL and the site ID of the website you want to track.
  • Node.js 24 for preparing the Lambda deployment package.
  • Access to a terminal, such as PowerShell.

Step 2: Download the CloudFront Tracker

  1. Open the Matomo CloudFront Tracker repository.
  2. Clone or download the repository and extract its contents.
  3. Open a terminal in the project folder containing package.json.
  4. In the project folder, run the following commands to install the project dependencies and create the dist/index.js file used by AWS Lambda:
npm install
npm run build

Step 3: Configure and deploy the Lambda function

  1. In the AWS console, open Lambda and create a function using the Node.js 24 runtime.
  2. Configure the function handler as index.handler.
  3. Confirm that the npm run build command generated the dist/index.js file.
  4. In your terminal, run the following command from the project folder to create the Lambda deployment package: zip -j lambda.zip dist/index.js
  5. The command creates a lambda.zip archive containing index.js at the root of the archive. The bundled file includes the application dependencies, so you do not need to include node_modules.
  6. In AWS Lambda, upload lambda.zip as the function’s deployment package.
  7. Under Environment variables, configure the following:
    • MATOMO_URL (required): Your Matomo base URL, without /matomo.php.
    • MATOMO_SITE_ID (required): The site ID of the website you want to track.
    • MATOMO_TOKEN_AUTH (optional, recommended): A Matomo authentication token used to authenticate tracking requests. The token is required when submitting tracking data with timestamps older than 24 hours, for example when processing older CloudFront access logs. Keep the token secure and do not include it in publicly accessible configuration files.
  8. Configure the Lambda execution role with permission to read CloudFront access logs from S3 and write logs to Amazon CloudWatch.

Note: The deployment package uses an ES module. Leave NODE_OPTIONS unset unless your AWS environment specifically requires it.

See the CloudFront Tracker deployment instructions for additional information about IAM permissions and deployment options.

Step 4: Configure CloudFront logging and the S3 trigger

CloudFront must deliver access logs to an Amazon S3 bucket so the Lambda function can identify AI chatbot requests and send tracking data to Matomo.

  1. In Amazon CloudFront, confirm that standard access logging is enabled for your distribution and configured to deliver compressed log files to an Amazon S3 bucket.
  2. Ensure the access logs contain the fields required by the tracker, including: date, time, cs-method, cs-protocol, x-host-header, cs-uri-stem, cs-uri-query, sc-status, time-taken, sc-bytes, cs(User-Agent).
  3. In AWS Lambda, add an S3 trigger for the bucket containing your CloudFront access logs.
  4. Configure the trigger with the following settings:
    • Event type: All object create events (s3:ObjectCreated:*).
    • Suffix: .gz to process compressed access log files.
    • Prefix (optional): The folder prefix where CloudFront stores its access logs, if applicable.
  5. Confirm that the S3 trigger matches the bucket and location where CloudFront delivers the log files.

When CloudFront delivers a new log file, the S3 event triggers Lambda. The function reads the log, identifies eligible AI chatbot requests and sends the tracking data to Matomo.

See the CloudFront Tracker deployment instructions for additional S3 and logging configuration details.

Verify tracking is enabled

After deploying the Cloudflare or Amazon CloudFront integration, send a test request to confirm that Matomo records AI chatbot activity.

Open a terminal and run the following command, replacing the example URL with your website’s public URL. This sends a request using a supported AI chatbot User-Agent.

curl -A "ChatGPT-User" "https://www.example.com/"

Note: For Windows PowerShell, use curl.exe instead of curl.

In Matomo, open AI Assistants > AI Chatbots Real-time and check whether the simulated request appears in the report.
view ai chatbots real-time report

A successful website response confirms that the HTTP request completed, but does not guarantee Matomo recorded it.

For Cloudflare, allow time for asynchronous processing. For Amazon CloudFront, allow additional time for access logs to reach S3 and be processed by Lambda.

Check Cloudflare tracking

  1. Confirm that the test URL matches the route assigned to your Cloudflare Worker.
  2. Check the Cloudflare Worker logs for tracking activity or errors.
  3. Allow time for the tracking request to be processed, as Cloudflare sends tracking requests asynchronously.

Check Amazon CloudFront tracking

  1. Confirm that the test request was sent through your CloudFront distribution.
  2. Check that CloudFront delivered an access log file to the configured S3 bucket.
  3. Confirm that the S3 event triggered your Lambda function.
  4. In Amazon CloudWatch, check the Lambda logs for processing activity, tracking results or errors.

CloudFront tracking is not immediate. The request must first appear in the CloudFront access logs, which are delivered to S3 and processed by Lambda before tracking data is sent to Matomo.

Data retention

AI chatbot telemetry is stored as raw log data in Matomo. This data follows the same retention and cleanup rules as other raw tracking logs. When the Delete old raw data from the database setting is enabled, Matomo automatically removes AI chatbot telemetry after the configured retention period.

  • No visit or aggregated data is created from this telemetry.
  • No additional configuration is required to enable cleanup.
  • Deletion affects all stored AI chatbot telemetry.

This behaviour applies to both Matomo Cloud and Matomo On-Premise instances.

Filtering and exclusions

AI chatbot telemetry is request-based and can generate large volumes of data. Applying filtering at the edge helps reduce noise and keeps telemetry focused on meaningful requests.

Common exclusions include:

  • /robots.txt
  • health check endpoints
  • internal or diagnostic URLs

Filtering should be applied before sending telemetry to Matomo, for example in your Cloudflare Worker or Amazon CloudFront Lambda logic. This ensures that only relevant AI chatbot requests are recorded and stored.

When to use the HTTP Tracking API directly

If you need a custom integration, or you are not using Cloudflare, CloudFront, or WordPress, you can send AI chatbot telemetry directly using the HTTP Tracking API.

  1. Start with the Tracking API documentation to understand how to construct tracking requests.
  2. Then refer to the Tracking Bots API reference for the supported parameters and processing behaviour specific to AI chatbot telemetry.

This approach is suitable when you control the request flow directly and tracking is implemented in server-side code or middleware. Tracking requests sent this way follow the same no-visit tracking rules as the Cloudflare and CloudFront integrations. Edge or CMS integrations are not applicable.

Previous FAQ: Do AI assistants or bots affect hits and cost?