Google Analytics Advanced Regular Expressions RegEx

Use analytics for better SEO  /  Practical playbook  /  2026–2027 edition

Regex for GA4 & Search Console. Better filters. Better questions.

36 tested recipes to group search demand, investigate content and read recorded AI traffic, plus what Google’s 2026 AI features change about how you filter.

What do I need to know?Which values should match?Did the right rows match?What happens next?QUESTIONFILTERCHECKDECISIONGA4 PAGE PATH · FULL MATCH^/(blog|guides)(/[^?#]*)?$✓ INCLUDED /blog/regex/✓ INCLUDED /guides✗ EXCLUDED /blogger/
A match is a hypothesis, not a finding. Teaching illustration with original patterns and synthetic values.
36 tested recipesEach with its field, match settings and next decision.
144 sample checks passedIncluded and excluded values tested in Google RE2.
Updated for 2026 AI featuresAI Assistant channel, AI-powered configuration, generative AI reports.

Most regex cheat sheets stop at “it matches.” That is where the analysis should start. A pattern that returns rows has only told you those rows share some text. What they mean, and whether to act, still needs a question and a check.

This guide is for SEOs, analysts and content teams who already open GA4 Explore or the Search Console Performance report every week. If you want a pattern list with no reasoning, it is the wrong guide. If you want to stop shipping filters you cannot defend, read on.

The working method

Question → Filter → Check → Decision. Define the question, group the right values, inspect the matches, then decide what to investigate or change. A match is a hypothesis, not a finding.

I approach analytics the way I approach technical SEO: inspect the input, test the assumption, and connect the finding to a practical decision. My engineering background and Diploma in Applied Data Science at LIBA shape that habit. The 36 recipes are original teaching examples across six business types, and every value in them is synthetic. None is a client result.

012026–2027 update

Three things changed. The method did not.

Google added AI to both tools in the last year, and each change touches how you filter. None of them removes the need to define a group of values and check what matched. They change which job regex should do.

When What changed What it means for your filters
Dec 2025 Search Console AI-powered configuration. An experimental option that turns a plain-language request into filters, comparisons and metric selections for the Search results report. It is limited to a set of sites, cannot sort or export, and works only for Search results. Google describes it on the Search Central blog. Faster for exploratory questions. Keep a regex when you need a definition someone else can read, reuse and challenge.
May 2026 GA4 AI Assistant default channel. Sessions from recognised AI assistant referrers are grouped as AI Assistant, with the medium set to ai-assistant, instead of landing in Referral. Search Engine Journal reported it on 14 May 2026. Start with the channel. Use a source regex only for gaps: assistants Google does not recognise, or your own campaign names.
Jun 2026 Search Console generative AI performance reports. Impressions in generative AI features across Search and Discover, by page, country, date and (for Search) device. Google is rolling them out to a subset of sites and has said more metrics may follow. A separate dataset. A query regex cannot label GA4 sessions as coming from an AI feature.
Ongoing GA4 Ask Advisor (beta) and the Search Console branded and non-branded filter. Use them when they are available to your property. Regex is the fallback when you need a transparent definition or the built-in option is missing.
02Foundation

First, get the match right. The same pattern tells two different stories.

Regex describes text patterns. It filters values in a field you select; it does not understand a customer journey. Start with the platform, the field, the operator and the case handling. Google documents full, case-sensitive matching as the Analytics default. Search Console documents partial, case-insensitive matching by default.

Context Match behaviour Practical implication
GA4 Explore → matches regex Full value; case sensitive by default blog does not match /blog/regex/.
GSC → Custom (regex) Partial; case insensitive by default blog can also match blogger.
GA4 event create or modify Runs in the browser A separate job from reporting filters. Review complexity before deploying.

Both tools use the RE2 syntax, which supports alternation, character classes, anchors and repetition but not lookahead, lookbehind or backreferences. For a simple exclusion, use the interface’s Doesn’t match operator. For complex include-and-exclude logic, use a segment, an export or the API. A leading (?i) makes a match case insensitive; Search Console documents (?-i) to require case-sensitive matches. Record whichever you choose.

Event creation deserves its own review. Google says those rules run in the browser and can suffer from expensive backtracking, so a pattern that is fine for a report is not automatically safe there.

The 13 characters you will actually use

Every recipe in this guide is built from these. Each example below was run in Google’s RE2 engine.

Symbol Name and meaning Example Matches Does not match
. Dot
Any single character
c.t
Full match
cat, cut ct, caat
* Asterisk
Zero or more of the previous item
ab*c
Full match
ac, abbc adc
+ Plus
One or more of the previous item
go+gle
Full match
gogle, google ggle
? Question mark
Makes the previous item optional
colou?r
Full match
color, colour colouur
.* Dot-asterisk
Any run of characters, including none
/uae/.*/cabinets
Full match
/uae/dubai/cabinets /uae/cabinets
^ Caret
Start of the value
^/store
Partial match
/store/bags /shop/store
$ Dollar
End of the value
wear$
Partial match
menswear wears
| Pipe
OR between alternatives
pricing|demo
Partial match
book a demo contact us
( ) Parentheses
Group alternatives or a sequence
/apparel/(mens|womens)/
Partial match
/apparel/mens/shirts /apparel/kids/
[ ] Square brackets
One character from a set
a[bcd]e
Full match
abe, ace abcde
- Dash
A range inside brackets
2026-0[1-9]
Full match
2026-01, 2026-09 2026-10
{ } Curly brackets
A repeat count
^SKU-[0-9]{3}$
Full match
SKU-123 SKU-12, SKU-1234
\ Backslash
Treat the next character as plain text
example\.com
Partial match
example.com exampleXcom

Boundary and token examples target English text. Review Tamil and other languages with your actual strings and a suitable Unicode-aware pattern. Paste the pattern without JavaScript-style enclosing slashes. When you need a word boundary, \b is ASCII in RE2, so \bcost\b avoids costume in English text.

03Workflow

Choose the field before you copy the pattern.

Search Console

Group searches or pages

  1. Open Performance → Search results and choose dates.
  2. Add a Queries or Pages filter.
  3. Choose Custom (regex), then Matches or Doesn’t match.
  4. Apply the pattern and inspect the retained rows.
GA4

Build a Free-form exploration

  1. Open Explore → Free form.
  2. Import the recipe’s dimension and compatible metrics.
  3. Add the dimension to Rows and metrics to Values.
  4. In Filters, include the dimension with matches regex.

A Search Console Page value is a full URL. A GA4 page-path dimension is a path. Landing page + query string includes its query string, and Session source holds a source value, not a whole URL. Test the exact field. In GA4, add a Web platform condition when you analyse mixed web and app data.

A GA4 exploration filter restricts that exploration. Segments can define users, sessions or events. If you want later purchases from sessions that viewed a collection, define the session population. Filtering only page events can remove the purchase events you meant to inspect.

Use simple exact or contains conditions when they answer the question. GA4 comparisons document their own operators, so do not assume every report has the same regex menu. The recipes use Explore for a consistent starting point.

Record this before reporting a result

Property · date range · field · operator · case handling · pattern · additional conditions · metric scope. That small record is what makes a filter reproducible.

04Decision guide

Climb the Filter Ladder only as far as the question needs.

I treat filtering as four rungs. Start on the lowest one that can answer the question, and climb only when it cannot. Most wasted analysis time comes from starting at rung three.

Rung Use it when Where it stops
1. Built-in filter
Branded queries filter, GA4 channel groups
A standard split answers the question and your property qualifies. Eligibility limits (Google documents them for the branded filter) and no control over the definition.
2. AI-powered configuration
Search Console, experimental
You are exploring, and speed matters more than a reusable definition. Search results only, limited availability, no sorting or export, and it can misread a request.
3. Regex
GSC custom filter, GA4 Explore
You need a transparent, repeatable group that a colleague can inspect. RE2 subset. You maintain it, and it matches strings, not meaning.
4. Segment or API
GA4 segments, Search Analytics API
You need include-and-exclude logic, session scope or a scheduled pull. More setup, authorisation, and row limits.

Try it · Prompt-to-regex builder

Turn one question into an AI prompt and its regex twin.

Describe the question once. You get a prompt to test in Search Console’s AI-powered configuration, and the regex that should return the same group, so you can compare the two. The prompt is a suggested request, not a guaranteed product response.

Show

AI-POWERED CONFIGURATION PROMPT

REGEX TWIN · SEARCH CONSOLE ·

Run both and compare the rows. If the AI configuration and the regex disagree, the disagreement is the finding: one of them is grouping values you did not intend.

05Try it

See the matches before you trust the filter.

Pick a recipe, or choose Custom pattern to test your own. Paste sanitised values from the same field, one per line. Everything runs in your browser; nothing is sent anywhere.

The 36 recipes were checked in Google’s RE2 engine. This lab runs your browser’s JavaScript regex engine over the shared syntax, so it is not a full RE2 validator; it flags lookahead, lookbehind and backreferences, which RE2 rejects. It tests up to 50 lines of 300 characters and does not save your input. Always verify in the destination field.

06The recipe library

Start with the decision your business needs.

Each recipe defines one string group and names the question, the field, the match settings, the review point and the next decision. The patterns are original and built on the documented matching rules. Intent labels are working hypotheses for manual review. Paths, product codes, names and custom events must match your implementation.

36 recipes available

6 PRACTICAL RECIPES

Foundations

Start with a clean definition of the group. A named pattern is a working classification that you can inspect and improve.

01GSCQueries

Group known brand and name variants

Which visible searches mention my known names?

\b(seo[\s-]?analyst|manikandan(\s+nagappan)?)\b

Matches regex · Partial · case insensitive

Inspect: Read clicks and impressions across this defined name set.

Next decision: Inspect matched queries and add genuinely observed aliases.

See matches, exclusions and the review point
INCLUDED

  • seoanalyst.me
  • Manikandan Nagappan regex
EXCLUDED

  • seo analysis tools
  • manikandann services

Review point: SEO Analyst is also a generic job phrase. Manually review ambiguity; replace all names for your brand.

02GSCQueries

Inspect the remaining visible queries

What demand remains after excluding my defined brand set?

\b(seo[\s-]?analyst|manikandan(\s+nagappan)?)\b

Doesn’t match regex · Partial · case insensitive

Inspect: Read nonmatching visible queries as a working discovery set.

Next decision: Find relevant questions that your current pages do not answer.

See matches, exclusions and the review point
INCLUDED

  • technical seo checklist
  • regex for analytics
EXCLUDED

  • seoanalyst.me
  • Manikandan Nagappan guide

Review point: Missed aliases can remain. Anonymised queries prevent this from being a complete nonbrand census.

03GSCQueries

Find question-led searches

Which visible queries begin like questions?

^(how|what|why|when|where|who|which|can|does|is|are|do|should)\b

Matches regex · Partial · case insensitive

Inspect: Review questions, their landing pages and search exposure.

Next decision: Add a direct answer where it helps the page complete its purpose.

See matches, exclusions and the review point
INCLUDED

  • how to use regex in ga4
  • Can regex filter queries
EXCLUDED

  • ga4 regex tutorial
  • showcase analytics

Review point: English starters are a heuristic. They do not detect all questions or identify AI-originated searches.

04GSCQueries

Review searches of eight or more tokens

What context appears in longer visible searches?

^\S+(\s+\S+){7,}$

Matches regex · Partial · case insensitive

Inspect: Read constraints such as audience, task and implementation detail.

Next decision: Group recurring needs rather than publishing one page per query.

See matches, exclusions and the review point
INCLUDED

  • how do i filter ga4 traffic from ai assistants
  • which seo tool works best for large ecommerce websites
EXCLUDED

  • how to use ga4 regex
  • seo checklist

Review point: This counts whitespace-separated tokens, not linguistic words. Long queries are not proof of AI usage.

05GSCPages

Group content sections by full URL

How are my blog and guide sections appearing in Search?

^https?://[^/]+/(blog|guides)(/|[?#]|$)

Matches regex · Partial · case insensitive

Inspect: Compare page-level trends within the selected sections.

Next decision: Open the Queries tab to understand the questions associated with them.

See matches, exclusions and the review point
INCLUDED

  • https://example.com/blog/regex/
  • https://example.com/guides?sort=new
EXCLUDED

  • https://example.com/blogger/
  • https://example.com/products/blog/

Review point: GSC Pages contains full URLs. The host wildcard includes any host present in the selected property.

06GA4Page path and screen class

Group the same content by path

Which recorded page views belong to these sections?

^/(blog|guides)(/[^?#]*)?$

Matches regex · Full · case sensitive

Inspect: Use Views and engagement metrics for the selected page paths.

Next decision: Inspect the pages, then use a session segment if the question concerns later actions.

See matches, exclusions and the review point
INCLUDED

  • /blog/regex/
  • /guides
EXCLUDED

  • https://example.com/blog/regex/
  • /blogger/

Review point: Use web data. An event-level page filter does not automatically include later events on other pages.

4 PRACTICAL RECIPES

B2B

Separate evaluation language, trust questions, solution pages and lead events. A form view and a qualified lead are different things.

07GSCQueries

Find provider-evaluation language

Which visible searches include provider-selection terms?

\b(consultants?|consulting|agency|agencies|providers?|vendors?)\b

Matches regex · Partial · case insensitive

Inspect: Review candidate evaluation queries by relevant service page.

Next decision: Improve scope, fit, process and evidence on the appropriate service page.

See matches, exclusions and the review point
INCLUDED

  • enterprise seo consulting india
  • compare analytics vendors
EXCLUDED

  • agencywide announcement
  • consultation meaning

Review point: A provider word does not prove buying intent. Check every query in context.

08GSCQueries

Surface security and compliance questions

Are buyers asking about security or compliance topics?

\b(soc[ -]?2|iso[ -]?27001|gdpr|hipaa)\b

Matches regex · Partial · case insensitive

Inspect: Read the exact requirements mentioned alongside your product or topic.

Next decision: Have the responsible subject expert review the relevant answer and supporting documents.

See matches, exclusions and the review point
INCLUDED

  • soc 2 analytics software
  • HIPAA platform requirements
EXCLUDED

  • social analytics tools
  • iso 9001 guide

Review point: A matching query establishes demand language. It never establishes your compliance status.

09GA4Page path and screen class

Compare selected industry-solution pages

How do these industry-specific pages perform after arrival?

^/(solutions|industries)/(banking|healthcare)(/[^?#]*)?$

Matches regex · Full · case sensitive

Inspect: Compare views and engagement for each path; preserve the individual rows.

Next decision: Use a session segment to investigate subsequent lead events.

See matches, exclusions and the review point
INCLUDED

  • /solutions/banking/
  • /industries/healthcare/platform/
EXCLUDED

  • /industries/retail/
  • /blog/banking/

Review point: Replace industries and routes. Page paths reveal content visited, not the visitor’s employer or industry.

10GA4Event name

Audit the events used for lead reporting

Which of my defined lead-related events are being recorded?

^(generate_lead|demo_request|contact_submit)$

Matches regex · Full · case sensitive

Inspect: Inspect Event count and event definitions before judging lead volume.

Next decision: Validate firing rules and reconcile with accepted leads in your own process.

See matches, exclusions and the review point
INCLUDED

  • generate_lead
  • demo_request
EXCLUDED

  • contact_view
  • generate_lead_error

Review point: Event names are examples; custom events must exist. An event count is not a unique or qualified-lead count.

4 PRACTICAL RECIPES

B2C

Group local, price and seasonal language, and inspect store or location pages without assuming purchase intent.

11GSCQueries

Find location and proximity language

Which visible searches explicitly mention these places?

\b(near me|chennai|bengaluru|bangalore)\b

Matches regex · Partial · case insensitive

Inspect: Review query wording, relevant pages and device context.

Next decision: Improve genuine service-area details where they answer the observed need.

See matches, exclusions and the review point
INCLUDED

  • repair services near me
  • service centre Chennai
EXCLUDED

  • chennaites guide
  • nearby services

Review point: A place in a query is not the user’s measured location. Edit the geography and languages.

12GSCQueries

Inspect price-related searches

What price or fee questions are visible?

\b(prices?|costs?|fees|affordable)\b

Matches regex · Partial · case insensitive

Inspect: Read the query and landing page together for missing pricing context.

Next decision: Clarify inclusions, conditions and genuine price ranges when publishable.

See matches, exclusions and the review point
INCLUDED

  • repair cost in chennai
  • affordable home services
EXCLUDED

  • costume ideas
  • priceless moments

Review point: Price words can occur in unrelated contexts; review intent and relevance.

13GA4Page path and screen class

Inspect selected store or location pages

How are these location pages being used?

^/(locations|stores)/(chennai|bengaluru)(/[^?#]*)?$

Matches regex · Full · case sensitive

Inspect: Compare page engagement and separately validate contact actions.

Next decision: Check addresses, opening hours and the mobile contact journey.

See matches, exclusions and the review point
INCLUDED

  • /stores/chennai/
  • /locations/bengaluru/contact/
EXCLUDED

  • /stores/mumbai/
  • /blog/chennai/

Review point: These routes are illustrative. A location-page visit does not establish an in-store visit.

14GSCQueries

Group seasonal search language

Which recurring seasonal needs appear in my visible queries?

\b(diwali|christmas|black friday|new year)\b

Matches regex · Partial · case insensitive

Inspect: Use comparable seasonal windows and inspect the actual matched subjects.

Next decision: Update useful evergreen seasonal pages before the next relevant period.

See matches, exclusions and the review point
INCLUDED

  • diwali offers near me
  • new year gift guide
EXCLUDED

  • yearly planner
  • friday working hours

Review point: Seasonal keywords are examples. A calendar date alone does not make a query commercially relevant.

4 PRACTICAL RECIPES

Ecommerce

Define shopping language, product-code routes, collection groups and the event vocabulary before judging performance.

15GSCQueries

Find purchase and promotion language

Which visible searches contain possible shopping language?

\b(buy|shop|order|discount|coupon|deals?)\b

Matches regex · Partial · case insensitive

Inspect: Review the category or product page serving each relevant query.

Next decision: Investigate availability, product information and the offer journey.

See matches, exclusions and the review point
INCLUDED

  • buy running shoes online
  • shoe discount code
EXCLUDED

  • buyer journey definition
  • shopping behaviour

Review point: Order can mean order status, and shop can be informational. Keep those intents separate.

16GA4Page path and screen class

Inspect a defined product-code route

Which page paths follow this product-code convention?

^/products/[A-Z]{2}-[0-9]{4}/?$

Matches regex · Full · case sensitive

Inspect: Inspect product-page views for the matched route set.

Next decision: Connect the results to product content and implemented ecommerce events.

See matches, exclusions and the review point
INCLUDED

  • /products/AB-1234/
  • /products/ZX-9081
EXCLUDED

  • /products/ab-1234/
  • /products/AB-12345/

Review point: Adapt to your actual URL convention. The pattern checks the route shape; it does not validate an SKU or product existence.

17GA4Page path and screen class

Group related collection pages

How are these related collection pages being consumed?

^/collections/(running-shoes|walking-shoes)(/[^?#]*)?$

Matches regex · Full · case sensitive

Inspect: Compare page engagement before making merchandising changes.

Next decision: Use compatible item data or a scoped session analysis for shopping outcomes.

See matches, exclusions and the review point
INCLUDED

  • /collections/running-shoes/
  • /collections/walking-shoes/women/
EXCLUDED

  • /collections/running-shoes-sale/
  • /products/running-shoes/

Review point: A page filter alone cannot attribute every later purchase to the collection. Check scope and instrumentation.

18GA4Event name

Check the shopping-event vocabulary

Are the main implemented shopping events visible?

^(view_item|add_to_cart|begin_checkout|purchase)$

Matches regex · Full · case sensitive

Inspect: Read event rows as recorded actions; inspect implementation quality.

Next decision: Build a Funnel exploration with explicit steps to examine sequence and drop-off.

See matches, exclusions and the review point
INCLUDED

  • add_to_cart
  • purchase
EXCLUDED

  • view_item_list
  • purchase_error

Review point: These are recommended event names, but collection requires implementation. Dividing event counts is not a reliable funnel.

4 PRACTICAL RECIPES

Enterprise

Handle locales, business units, hostnames and noisy query sets with explicit, reviewable definitions.

19GSCPages

Group locale URL directories

How do selected locale directories appear in Search?

^https?://[^/]+/(en-(in|gb|us)|fr-fr)(/|[?#]|$)

Matches regex · Partial · case insensitive

Inspect: Compare the relevant locale pages with consistent dates and settings.

Next decision: Then inspect country/device breakdowns and language implementation separately.

See matches, exclusions and the review point
INCLUDED

  • https://example.com/en-in/services/
  • https://example.com/fr-fr/
EXCLUDED

  • https://example.com/en-internal/
  • https://example.com/blog/en-in/

Review point: A locale path identifies a content route. It does not prove searcher geography or correct hreflang.

20GA4Page path and screen class

Group business-unit content

Which visits or page events belong to these business-unit routes?

^/(cloud|cybersecurity|consulting)(/[^?#]*)?$

Matches regex · Full · case sensitive

Inspect: Compare page views and engagement while retaining route-level detail.

Next decision: Build separate scoped analyses for each unit’s meaningful actions.

See matches, exclusions and the review point
INCLUDED

  • /cloud/services/
  • /cybersecurity/
EXCLUDED

  • /cloud-native-news/
  • /blog/consulting/

Review point: Edit routes to match your information architecture. A combined filter alone does not create mutually exclusive business-unit attribution.

21GSCQueries

Remove obvious recruitment-language candidates

What remains after a defined recruitment-language exclusion?

\b(jobs?|careers?|salary|salaries|internships?)\b

Doesn’t match regex · Partial · case insensitive

Inspect: Review the retained query set for relevance to business demand.

Next decision: Compare recruitment and business content separately before drawing conclusions.

See matches, exclusions and the review point
INCLUDED

  • cloud consulting services
  • enterprise security platform
EXCLUDED

  • cloud jobs india
  • consulting salary

Review point: Job scheduling software is a false exclusion. This is a working language filter, not perfect audience classification.

22GA4Hostname

Review an explicit hostname set

Which collected events use these approved hostnames?

^(www\.)?(example\.com|example\.co\.in)$

Matches regex · Full · case sensitive

Inspect: Inspect the included hosts, and invert the analysis to investigate others.

Next decision: Check tag deployment and cross-domain measurement before changing collection.

See matches, exclusions and the review point
INCLUDED

  • www.example.com
  • example.co.in
EXCLUDED

  • example.com.evil.test
  • preview.example.com

Review point: Replace example domains. A report filter does not stop spam, remove historical data or secure the website.

4 PRACTICAL RECIPES

Publishers

Separate editorial topics, archive conventions and subscriber actions. A dated route and an explainer phrase describe different things.

23GSCPages

Group editorial sections

Which editorial sections earn visible Google Search demand?

^https?://[^/]+/(technology|business|science)(/|[?#]|$)

Matches regex · Partial · case insensitive

Inspect: Compare section-level clicks and impressions in the same Search report.

Next decision: Open specific stories and queries to identify durable follow-up questions.

See matches, exclusions and the review point
INCLUDED

  • https://example.com/science/article/
  • https://example.com/business/
EXCLUDED

  • https://example.com/businesses/
  • https://example.com/author/science/

Review point: Search results, Discover and Google News are separate reports. Do not infer total audience from this selection.

24GA4Page path and screen class

Inspect a dated archive route

Which measured pages follow my year/month archive structure?

^/20[0-9]{2}/(0[1-9]|1[0-2])(/[^?#]*)?$

Matches regex · Full · case sensitive

Inspect: Review consumption for this URL convention.

Next decision: Check each story’s real publication and update dates before planning refreshes.

See matches, exclusions and the review point
INCLUDED

  • /2026/10/regex-guide/
  • /2025/01/
EXCLUDED

  • /2026/13/story/
  • /news/2026/10/

Review point: The route does not establish content freshness, complete date validity or publication quality.

25GSCQueries

Find explainer-style language

Where do visible searches suggest an explanation need?

\b(what is|why does|how does|explained|meaning)\b

Matches regex · Partial · case insensitive

Inspect: Inspect which stories or explainers answer these questions.

Next decision: Improve clarity and add suitable evidence or context.

See matches, exclusions and the review point
INCLUDED

  • what is query fan out
  • inflation explained
EXCLUDED

  • meaningful analytics
  • how to implement schema

Review point: English phrase matching misses many explanation queries. Matches are candidates, not a complete intent category.

26GA4Event name

Audit subscription-related events

Which defined subscriber actions are recorded?

^(sign_up|newsletter_subscribe|subscription_start)$

Matches regex · Full · case sensitive

Inspect: Review event counts alongside your implementation and subscription records.

Next decision: Separate free signups from paid subscription starts and deduplicate appropriately.

See matches, exclusions and the review point
INCLUDED

  • newsletter_subscribe
  • sign_up
EXCLUDED

  • newsletter_view
  • subscription_error

Review point: Custom names must be implemented. A sign_up event may represent an account rather than a newsletter subscription.

4 PRACTICAL RECIPES

SaaS

Distinguish comparison demand, pricing landings, documentation use and genuine activation. Each needs a different field or scope.

27GSCQueries

Find comparison and alternative searches

Which searches include candidate product-evaluation language?

\b(alternatives?|vs|versus|compare|comparison)\b

Matches regex · Partial · case insensitive

Inspect: Inspect product names, suitability questions and relevant landing pages.

Next decision: Build fair comparisons with explicit fit criteria and substantiated differences.

See matches, exclusions and the review point
INCLUDED

  • acme crm alternatives
  • acme vs example crm
EXCLUDED

  • comparative analysis
  • divs in html

Review point: A comparison term alone does not establish purchase readiness. Acme is an illustrative product name.

28GA4Landing page + query string

Analyse pricing landings including query strings

How do sessions beginning on pricing behave?

^/pricing/?(\?[^#]*)?$

Matches regex · Full · case sensitive

Inspect: Use compatible Sessions and session-scoped key-event metrics.

Next decision: Compare device or acquisition source, then test the pricing journey.

See matches, exclusions and the review point
INCLUDED

  • /pricing/
  • /pricing?plan=team&utm_source=newsletter
EXCLUDED

  • /pricing-guide/
  • https://example.com/pricing/

Review point: This field includes query strings. The same expression is not intended for a full page_location URL.

29GA4Page path and screen class

Separate documentation and support content

Which recorded page activity belongs to support routes?

^/(docs|help|support)(/[^?#]*)?$

Matches regex · Full · case sensitive

Inspect: Inspect the topics and engagement within the selected paths.

Next decision: Use a session segment to examine later adoption events where measured.

See matches, exclusions and the review point
INCLUDED

  • /docs/api/auth/
  • /help/
EXCLUDED

  • /documentation/
  • /blog/helpful-tips/

Review point: Support content can serve prospects and existing customers. Route names do not identify lifecycle stage.

30GA4Event name

Review a proposed activation-event set

Are my defined signup and activation actions recorded?

^(sign_up|trial_start|workspace_created|activation_complete)$

Matches regex · Full · case sensitive

Inspect: Read event definitions before comparing the counts.

Next decision: Create a scoped, ordered funnel and document the business definition of activation.

See matches, exclusions and the review point
INCLUDED

  • trial_start
  • workspace_created
EXCLUDED

  • trial_start_error
  • workspace_view

Review point: Custom events need implementation. A signup or workspace event does not automatically mean the user activated.

6 PRACTICAL RECIPES

AI analysis

Begin with the documented AI Assistant channel, then inspect actual source values. A regex cannot recover a missing referrer or identify every AI-influenced visit.

31GA4Session default channel group

Compare AI Assistant with Organic Search

How do these two recorded acquisition channels differ?

^(AI Assistant|Organic Search)$

Matches regex · Full · case sensitive

Inspect: Keep channel rows separate and compare sessions and useful outcomes.

Next decision: Start with the documented default classification before creating a custom taxonomy.

See matches, exclusions and the review point
INCLUDED

  • AI Assistant
  • Organic Search
EXCLUDED

  • Referral
  • Direct

Review point: Organic Search includes Google AI Overviews and AI Mode traffic. This does not isolate those visits.

32GA4Session source

Inspect a maintained assistant-source allowlist

Which sessions have these exact recorded source values?

^(chatgpt\.com|chat\.openai\.com|perplexity\.ai|claude\.ai|gemini\.google\.com|copilot\.microsoft\.com|chat\.deepseek\.com|grok\.com)$

Matches regex · Full · case sensitive

Inspect: Inspect each source and its observed landing pages.

Next decision: Maintain the allowlist from your own data and review meaningful outcomes.

See matches, exclusions and the review point
INCLUDED

  • chatgpt.com
  • perplexity.ai
EXCLUDED

  • notchatgpt.com
  • chatgpt.com.evil.test

Review point: Source values can be missing or differ. This list is illustrative, incomplete and not a census of AI citations or visits.

33GA4Session source / medium

Inspect selected source/medium pairs

Which observed assistant-source sessions use these media?

^(chatgpt\.com|perplexity\.ai|claude\.ai) / (ai-assistant|referral)$

Matches regex · Full · case sensitive

Inspect: Read the actual combined dimension, including spaces around its separator.

Next decision: Investigate unexpected media and tagging conventions before reclassifying.

See matches, exclusions and the review point
INCLUDED

  • chatgpt.com / ai-assistant
  • perplexity.ai / referral
EXCLUDED

  • chatgpt.com / cpc
  • chatgpt.com / (none)

Review point: This is a combined dimension pattern. Do not paste it into Session source or assume every source retains a referrer.

34GA4Session campaign

Audit an owned AI campaign naming convention

Which recorded campaigns follow this defined naming scheme?

^ai_(research|demo|newsletter)_[a-z0-9_-]+$

Matches regex · Full · case sensitive

Inspect: Inspect campaign rows for the controlled links you intentionally tagged.

Next decision: Document the convention and check the actual tagged links.

See matches, exclusions and the review point
INCLUDED

  • ai_demo_october
  • ai_newsletter_q4-2026
EXCLUDED

  • email_demo_october
  • ai_demo_

Review point: A campaign name beginning ai_ is your label. It does not prove an assistant generated the visit.

35GSCQueries

Find searches mentioning assistant products

Which visible Google queries mention these products?

\b(chatgpt|claude|perplexity|gemini|copilot)\b

Matches regex · Partial · case insensitive

Inspect: Review content demand about assistants and related use cases.

Next decision: Improve relevant explanations where you have actual experience to contribute.

See matches, exclusions and the review point
INCLUDED

  • chatgpt analytics tutorial
  • Claude for seo
EXCLUDED

  • chatgptlike tool
  • generic analytics guide

Review point: These are Google query strings. This filter cannot identify AI Mode, AI Overview or assistant referral traffic.

36GA4Landing page + query string

Inspect commercial landings inside an AI session segment

Where do the selected AI-acquired sessions begin?

^/(pricing|demo|contact-sales)/?(\?[^#]*)?$

Matches regex · Full · case sensitive

Inspect: First apply a session segment for AI Assistant; then review these landing paths.

Next decision: Compare session outcomes and test the pages with the largest practical opportunity.

See matches, exclusions and the review point
INCLUDED

  • /pricing?plan=team
  • /contact-sales/
EXCLUDED

  • /blog/pricing-guide/
  • /demo-gallery/

Review point: The path pattern alone identifies landing pages. The separate session condition is what selects recorded AI acquisition.

07AI analysis

Separate AI traffic, AI answers and AI-assisted analysis.

First check Session default channel group. Google documents an AI Assistant channel, and places visits from Google AI Overviews and AI Mode within Organic Search. An assistant-domain regex is therefore a supplementary investigation, not a universal AI visibility measure.

Question Useful starting point Interpretation limit
Which recorded sessions came from assistants? The GA4 AI Assistant channel and the actual session-source values Missing referrers and offline influence remain unobserved.
Did an answer engine cite my page? Record the answer, the question, the date and the cited URL A citation is not a visit or a conversion.
Where does my page appear in Google’s generative AI features? The Search Console generative AI performance report, where it is available to your site Impressions by page, country, date and device. It is a separate dataset from GA4 sessions.
Can AI configure or explain my report? Search Console AI-powered configuration or GA4 Ask Advisor, where available Review the filters, scope and response against the report.

If your business needs a custom channel definition, copy a group, use your observed source values and inspect the rule order: traffic belongs to the first matching channel. Custom groups can be applied retrospectively in reports, while audience behaviour and primary-channel changes have different timing. Keep a dated definition.

I prefer an explicit source allowlist over an expression such as .*ai.*, because a broad substring catches unrelated sources. Recipe 32 anchors known domain values and deliberately rejects chatgpt.com.evil.test. The list still needs maintenance as sources change.

For Google AI visibility, use the dedicated generative AI performance report rather than a query regex. A query pattern does not create an AI-feature attribution label for GA4 sessions.

Two prompts worth testing in the real products

GSC · AI-POWERED CONFIGURATION

“For the last 28 days, show queries containing ‘pricing’ or ‘demo’. Compare with the previous 28 days. Show clicks and impressions. Keep the current country filter.”

This experimental tool can suggest filters, comparisons and metric selections. It cannot sort tables or export data. Confirm the generated configuration, because availability is limited and a suggestion can be wrong. The prompt is a proposed request, not a guaranteed product response.

GA4 · ASK ADVISOR

“Compare sessions from AI Assistant and Organic Search for the last 28 days. State the date range and dimension scope, link the supporting report, and identify limits before suggesting an explanation.”

Ask Advisor is a beta experience for eligible accounts and answers from the selected property. Inspect the underlying report before accepting an explanation. It cannot recreate missing measurement data.

08Put it to work

A practical investigation, from question to next action.

Example question: “Do our software comparison pages answer the questions visible in Search, and do sessions landing there take a useful next step?” This is an illustrative analysis plan, not a claim about a real property.

  1. Define the query cohort. Apply the SaaS comparison pattern (recipe 27) in Search Console and review the actual queries.
  2. Inspect the landing pages. Use the Pages tab with a consistent date range. Save the query group and the pages shown.
  3. Define the GA4 population. Use those landing paths in a session-focused exploration, keeping acquisition context and compatible metrics.
  4. Validate useful actions. Check that trial or lead events are implemented and mean what the business needs.
  5. Choose the investigation. If comparison content omits a recurring criterion, improve it. If the form fails, fix the journey. Collect evidence before deciding.

Treat this as a comparison of aggregated evidence. A query table and a session table give no person-level link between a Google query and a GA4 conversion. Search Console and Analytics differ in collection, aggregation and time-zone handling, so their totals are not expected to reconcile perfectly.

09Where this breaks

Debug the definition before you rewrite the strategy.

Symptom What to inspect Next action
No rows Wrong field, full versus partial matching, casing, existing filters, missing collection Start with one known value and the simplest operator.
Too many rows Unescaped dots, missing anchors, broad OR alternatives Add clear boundaries and inspect counterexamples.
Purchase events disappeared A page or event filter restricted the population Rebuild the question with a session segment or funnel.
Matched plus excluded is below the total Query anonymisation, truncation and aggregation Record the limit; do not invent the missing query distribution.
A pattern works in an online tester only PCRE lookaround, backreferences, JavaScript flags or copied delimiters Use the RE2-compatible subset and the field’s own operator.

Filtering a report changes the view. GA4 incoming data filters change collection and can permanently exclude future data, so do not activate a collection exclusion just to explore a question. If the real problem is accidental email or query-parameter collection, look at prevention and GA4 data redaction. A display filter is not a privacy fix.

Search Console may omit anonymised queries, so matched and non-matched totals can differ from the unfiltered total. The built-in branded and non-branded filter is useful where available, and Google documents eligibility limits including low-impression sites. A manual regex stays useful when you need a transparent definition or the built-in option is unavailable.

10Repeat it

Save the definition, then automate the repeatable work.

Once a segment is useful, save its definition with a few positive and negative tests. Keep examples that should fail, including similar path names, hostile-looking domain suffixes and wrong event names. That makes later edits easy to review.

In a GA4 Data API workflow, choose the match type explicitly. The API offers FULL_REGEXP, PARTIAL_REGEXP and caseSensitive, plus logical filter groups. Set them deliberately rather than expecting the interface defaults to carry over.

GA4 Data API dimensionFilter example

Illustrative filter object for runReport, not a complete request. Set the property, dates, dimensions and compatible metrics separately.

{
  "dimensionFilter": {
    "filter": {
      "fieldName": "sessionSource",
      "stringFilter": {
        "matchType": "FULL_REGEXP",
        "value": "^(chatgpt\\.com|perplexity\\.ai|claude\\.ai)$",
        "caseSensitive": false
      }
    }
  }
}
Include and exclude in one Search Console API request

Use an AND filter group: include pricing or demo language, then exclude your defined brand. That avoids unsupported negative lookahead. To pull these rows at scale, see the Search Console API and BigQuery guide. The API returns a limited number of rows per request and needs authorisation. This example was syntax-checked, not run against a private account.

{
  "startDate": "2026-09-01",
  "endDate": "2026-09-30",
  "type": "web",
  "dimensions": ["query", "page"],
  "dimensionFilterGroups": [{
    "groupType": "and",
    "filters": [
      { "dimension": "query", "operator": "includingRegex", "expression": "(?i)\\b(pricing|demo)\\b" },
      { "dimension": "query", "operator": "excludingRegex", "expression": "(?i)\\b(acme|examplebrand)\\b" }
    ]
  }],
  "rowLimit": 25000
}

An assistant can help draft a pattern or group exported rows. Ask it to name the field, engine, match mode and expected counterexamples, then test its output against real sanitised values. That is the boundary I want in agentic SEO work: tools organise evidence, and human review decides what the evidence supports.

Use the SEO checklist when your next action concerns access or content quality. If you need crawler behaviour rather than visit behaviour, continue with the log file analysis guide. They are related investigations with different inputs.

11Questions

Keep the limits visible.

Can regex identify Google AI Mode or AI Overview sessions in GA4?

A query phrase or an assistant-domain source regex cannot reliably do that. Google documents those visits under Organic Search, while AI Assistant is a separate channel. Use the product reporting for the specific surface, such as the Search Console generative AI performance report, and keep the limits of each measure in view.

Should I use Search Console’s AI-powered configuration or regex?

Use AI-powered configuration to explore quickly if your site has it, then keep a regex when you need a definition that is transparent, reusable and reviewable. If the two return different rows, inspect the difference before you report either.

Is the GA4 AI Assistant channel enough on its own?

It is the right first step, because it needs no setup. It depends on a referrer being passed, and Google has not published the full list of recognised assistants. Use a source allowlist regex to cover gaps and your own campaign names, and expect some assistant traffic to remain in Direct.

Can I use negative lookahead to exclude brand queries?

RE2 does not support lookahead. Use Search Console’s Doesn’t match regex operator for a simple brand exclusion. For more complex logic, use a supported segment, an export or an API filter group rather than copying a PCRE-only expression.

Does a matching event name create a conversion?

No. A report expression selects recorded values. The event must already be implemented correctly, and its meaning and key-event configuration need separate validation. Recommended ecommerce event names still require implementation.

Will these patterns work unchanged on my site?

Only when the selected field and your actual values follow the illustrated convention. Replace brand names, domains, routes and custom events, test both intended matches and exclusions, then inspect the retained rows.

Take the recipes with you

Keep the pattern. Keep the reasoning.

All 36 recipes with platform, field, match settings, tested inclusions and exclusions, and the next decision. Save the guide as a PDF, or export the recipes as a CSV for your own analysis notebook.

Questions about this guide?

Send me a note. I read every one.

Let’s connect ↗


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top