
Measure AI traffic in Matomo – Guide
ChatGPT, Claude, Perplexity – they send visitors to websites. In Matomo, this traffic ends up in the “Referral” channel, unsorted and invisible. This guide shows three ways to cleanly capture, analyze and continuously monitor AI traffic in Matomo – without external tools, in a privacy-compliant way and with historical data.
- Matomo vs. GA4: what is different?
- Why measure AI traffic separately?
- Method 1: Create a segment (recommended)
- The AI regex: complete list of all sources
- Method 2: Configure channel attribution
- Method 3: Custom Dimension via Tag Manager
- Analyze AI traffic in reports
- AI vs. Paid: set up channel comparison
- Export data & automate
- Multi-Site: one setup for all websites
- Frequently asked questions
1. Matomo vs. GA4: what is different?
Anyone familiar with the GA4 guide will notice one key difference: Matomo does not have custom channel groups. GA4 solves the problem through a rule set that classifies future traffic. Matomo takes a different approach, and in some respects a more elegant one.
Custom channel group with regex. Applies only to future sessions. Historical data remains uncategorized. Max. 2 groups per property.
Segments with regex. Apply retroactively to all stored raw data. Unlimited segments. No limit per website.
2. Why measure AI traffic separately?
AI systems are the new discovery layer: they read content, evaluate sources and provide concrete recommendations. If your site appears as a reliable source in ChatGPT or Perplexity, you get traffic. If it is not mentioned, you do not exist for a growing share of users.
In Matomo, this traffic – just like in GA4 – ends up in the “Referral” channel, mixed together with newsletter clicks, partner links and spam. The result: you cannot see whether AI systems are sending relevant visitors, which pages benefit from it and how well these users convert.
3. Method 1: Create a segment (recommended)
Segments are the fastest and most flexible solution. They apply retroactively, are available in every report and can be adjusted at any time – without data loss.
- Click the segment selector at the top (dropdown next to the calendar).
- Select + Add segment → the segment editor opens.
- Name the segment:
AI Traffic. - Under “Conditions”, click + Add condition.
- Select the dimension: Referrer URL (under “Visits”).
- Operator: matches regular expression.
- Value: paste in the regex from section 4.
- Click Save. Matomo calculates the segment retroactively – depending on the amount of data, this may take a few minutes.
4. The AI regex: complete list of all sources
This regex covers all relevant AI platforms: ChatGPT, Claude, Gemini, Perplexity, DeepSeek, Microsoft Copilot, Grok, Mistral, Hugging Face and more than 80 other sources. It is identical to the GA4 version and can be used directly in Matomo.
| operator. 5. Method 2: Configure channel attribution (from Matomo 4.x)
Channel attribution complements the segment: while segments are used for analysis, channel attribution permanently classifies traffic as a separate channel – visible in the report Referrers → Channels.
- In the Matomo backend, open the desired website under Administration → Websites.
- Select the Channel attribution tab.
- Click + Add new rule.
- Enter the channel name:
Artificial Intelligence. - Condition: Referrer URL → matches regular expression → paste in the regex.
- Place the rule above “Referral” in the order (drag & drop).
- Save. From now on, AI traffic will be classified as a separate channel.
6. Method 3: Custom Dimension via Tag Manager
For granular analyses – for example, to see which specific AI platform sent a visitor – a Custom Dimension is recommended. This is set on every page view via the Matomo Tag Manager.
Requirement
Matomo Tag Manager must be enabled and the container must be embedded on the website. Check this in the Matomo backend under Tag Manager → Container.
Create JavaScript tag
- Create a new tag of the type “Custom HTML”.
- Trigger: “Page View” (All Page Views).
- Insert the following JavaScript code:
(function() {
var ref = document.referrer || '';
var aiRegex = /chatgpt\.com|chat\.openai\.com|claude\.ai|perplexity(?:\.ai)?|gemini\.google\.com|deepseek\.com|copilot\.microsoft\.com|grok\.com|(?:\w+\.)?mistral\.ai|huggingface\.co|you\.com|phind\.com|duck\.ai|felo\.ai|coze\.com/;
if (aiRegex.test(ref)) {
// Extract the specific platform
var platform = 'Other AI';
if (/chatgpt\.com|chat\.openai\.com/.test(ref)) platform = 'ChatGPT';
else if (/claude\.ai/.test(ref)) platform = 'Claude';
else if (/perplexity/.test(ref)) platform = 'Perplexity';
else if (/gemini\.google\.com/.test(ref)) platform = 'Gemini';
else if (/deepseek\.com/.test(ref)) platform = 'DeepSeek';
else if (/copilot\.microsoft\.com/.test(ref)) platform = 'Copilot';
else if (/grok\.com/.test(ref)) platform = 'Grok';
else if (/mistral/.test(ref)) platform = 'Mistral';
else if (/huggingface\.co/.test(ref)) platform = 'HuggingFace';
// Set Custom Dimension 1 (adjust dimension ID if needed)
_paq.push(['setCustomDimension', 1, platform]);
}
})();
- Under Administration → Custom Dimensions → Visits, create a new dimension: Name
AI Platform, ScopeVisit. Adjust the assigned ID (e.g. 1) accordingly in the code above. - Save the tag and publish the container.
- From now on, the dimension is available in reports under Visitors → Custom Dimensions.
7. Analyze AI traffic in reports
As soon as the segment is active, it is available in every Matomo report as a filter. The most important reports for AI traffic analysis:
| Report | Path in Matomo | What you see |
|---|---|---|
| Referrer sources | Referrers → Websites | Which AI domains send traffic (chatgpt.com, claude.ai, perplexity.ai …) |
| Pages | Behavior → Pages | Which content AI users visit, bounce rate, time on page per page |
| Landing pages | Behavior → Entry Pages | Which pages are visited first – shows the relevance of the content |
| Visit overview | Visitors → Overview | Average session duration, pages/visit, bounce rate over time |
| Goals & conversions | Goals → Overview | How many AI users convert – value contribution of the channel |
| Visitor flow | Behavior → Visitor Flow | Which pages AI users visit after the landing page |
Activate segment
The segment filters the entire report immediately. All metrics – visits, time on site, bounce rate, goals – then refer only to sessions that came via AI platforms.
8. AI vs. Paid: set up channel comparison
Starting with version 4.x, Matomo offers the segment comparison feature: two segments are displayed side by side in one report. This makes it possible to compare AI traffic directly with Paid Search.
Create second segment: Paid Search
- Open the segment editor → create a new segment: Name
Paid Search. - Condition: Channel → is equal to →
Paid Search.
Alternatively: Referrer type → is equal to →Search engines (paid). - Save.
Activate comparison
- In the segment dropdown, select the first segment AI Traffic.
- Click “+ Add segment” and add Paid Search.
- Matomo displays both segments side by side – with all metrics from the active report.
- Optional: add a third segment
Organic Searchfor the full channel comparison.
9. Export data & automate
Manual export
Matomo exports the current report including the active segment in various formats. CSV is suitable for Excel analysis, PDF for client reports.
Automation via Reporting API
The Matomo Reporting API allows fully automated data queries with segment filtering. Example URL for the page report with AI segment:
https://[YOUR-MATOMO-URL]/index.php
?module=API
&method=Actions.getPageUrls
&idSite=1
&period=month
&date=last3
&format=CSV
&token_auth=[YOUR-TOKEN]
&segment=referrerUrl=~chatgpt.com,
referrerUrl=~claude.ai,
referrerUrl=~perplexity.ai
Scheduled reports by email
Matomo can send reports automatically by email – daily, weekly or monthly, as PDF or CSV. The segment can be stored as a filter in the report.
10. Multi-Site: one setup for all websites
Matomo offers a decisive advantage here over GA4: in one Matomo instance, segments can be created globally and used simultaneously across multiple websites.
Create global segment
- Open the segment editor → create a new segment.
- When saving, select the option “All websites” (instead of a specific website).
- The segment is now available in every website within the Matomo instance.
Channel attribution: set up per website
Channel attribution must be configured separately for each website – it is website-specific. With the prepared regex, however, this takes less than 3 minutes per website.
API-based rollout (for many websites)
Using the Matomo Admin API, segments and channel rules can be created programmatically and rolled out across any number of websites. This is useful for agencies with 10+ websites in one Matomo instance.
11. Frequently asked questions
Not directly. Matomo offers segments (retroactive for all historical data) and, starting with Matomo 4.x, channel attribution under Administration. For most use cases, segments are the faster and more flexible solution.
Yes – that is a key advantage over GA4. Matomo segments are calculated at the time of analysis and apply retroactively to all stored raw data, regardless of when the segment was created.
Yes. Matomo uses PCRE regex, which is fully compatible with the GA4 regex. The regex from this article can be pasted directly into Matomo without any adjustments.
Segments apply retroactively to all stored data and are available immediately. Channel attribution permanently classifies traffic as a separate channel in the Channels report, but only applies to future sessions from the time it is set up. Both methods complement each other well.
Yes. Global segments are available across all websites in a Matomo instance. The Matomo Reporting API can be used to centrally query and combine data from multiple websites.
All functions described in this article – segments, channel attribution, custom dimensions, API – are available both in the self-hosted open-source version and in Matomo Cloud. Channel attribution requires Matomo 4.x or higher.
Yes – especially then. AI traffic is growing disproportionately fast. Matomo has the advantage that no historical data is lost: the segment immediately delivers results for all previous data.
Matomo has a strategic advantage over GA4 that is often underestimated: the retroactive effect of segments means that companies that have been using Matomo for a longer period can immediately obtain a complete historical analysis of their AI traffic – without any data gap. This makes the growth trend particularly clear. Combined with GDPR compliance and hosting on your own server, Matomo is the more convincing choice for many of our clients for this type of analysis.
Have your AI visibility analyzed
We set up the Matomo segment for your website and show where AI systems are already mentioning you – and where untapped potential exists.
Request a free initial consultation