ecenticecentic
How it worksResourcesPricingBlog
Install now
ASCII-art illustration of a stack of books

UTM Tagging for AI Agents: One Medium, Clearer GA4 Referrals

Published: October 15, 2026 · By Xhurian Shaba, co-founder and CEO of ecentic

15 min read

Set a consistent ai_search medium, preserve UTMs through redirects, and order GA4 channel rules so AI agent referrals stay visible and easy to validate.

00

Introduction

Sketch motifs frame a clear title area

Set utm_medium=ai_search on every link you control, and pair it with a lowercase, controlled utm_source token for each surface: chatgpt, perplexity, gemini, claude, copilot. That one medium becomes the join key that lets analytics show AI-agent referrals as their own channel. Because UTMs are the highest-confidence signal, tag first and treat everything else as a fallback.


TL;DR:

  • Preserve the full query string through canonical redirects, proxies, CDN rules, and checkout hops; test each agent click through to its final landing URL.
  • In GA4, place the exact ai_search medium rule above referrer rules, then default Referral and Organic Search; classify untagged host matches as medium confidence.
  • When UTMs disappear, check referrers before user agent or server logs, and label inferred matches low confidence because crawler activity may not represent clicks.
  • For ecommerce, verify first touch UTMs reach order records after redirects and checkout, then compare AI attributed visits with conversions to identify listing fixes.

Ecentic
See How AI Evaluates Your Listings
Ecentic connects to Shopify or WooCommerce to show how AI agents evaluate product pages and where visibility can improve.
Explore Ecentic
01

What is the recommended UTM convention for AI agents?

What is the recommended UTM convention for AI agents?

The convention is short on purpose. The AI Search Referrer Attribution Reference Spec recommends utm_medium=ai_search, a controlled vocabulary for utm_source, UTMs preserved through redirects, and a GA4 custom channel group ordered by precedence. One literal medium token matters because every dashboard, filter and channel rule can then key off a single value instead of a pile of variants.

Here is the pattern we recommend:

  • utm_medium: the literal string ai_search, never varied by model or campaign.
  • utm_source: one of chatgpt, perplexity, gemini, claude, copilot, all lowercase. If you ever need a multi-word token, use a hyphen.
  • utm_campaign: the initiative, such as spring-catalog or product-feed.
  • utm_content: the placement, such as citation-link or structured-data.
  • utm_term (optional): a short hash that groups prompt cohorts without exposing raw prompt text.

Two examples you can copy:

https://example.com/products/trail-shoe?utm_source=chatgpt&utm_medium=ai_search&utm_campaign=spring-catalog

https://example.com/collections/rain-jackets?utm_source=perplexity&utm_medium=ai_search&utm_campaign=product-feed&utm_content=structured-data

Analytics Mania advises that consistency matters more than granularity: use a broad medium like ai_search and let utm_source carry the platform identity.

02

How do you add UTMs on controlled surfaces and keep them intact?

How do you add UTMs on controlled surfaces and keep them intact?

A tag only helps if it survives the trip to the landing page. Start by deciding where you can inject parameters: content citations, RSS or plugin outputs, structured data fields, and API-driven widgets. Anywhere you control the outbound URL, you control the attribution.

Google’s guidance on URL builders is to always set utm_source, utm_medium and utm_campaign, keep naming consistent, and add utm_id and utm_source_platform where possible to avoid “(not set)” values in reports. Follow it.

  1. List every place a link to your site is generated for AI surfaces: feeds, plugin outputs, structured data and widgets.
  2. Generate each URL with a builder, not by hand, so the vocabulary stays controlled.
  3. Configure canonical redirects so they forward the full query string to the final URL.
  4. Remove or reconfigure any proxy that strips query parameters.
  5. Set CDN edge rules to pass query strings through to the origin and cache by path, not by stripped URL.
  6. Click-test from each agent, inspect the final landing URL, and confirm the session-level utm values in GA4 or BigQuery.

Pro Tip: Test with a redirecting URL, not the final one. Most lost UTMs disappear in a redirect hop, and a direct landing-page test will never show it.

Our guide to how to track AI shopping traffic adds ecommerce-specific tests you can fold into this checklist.

03

How should GA4 attribution rules and channel-group precedence work for AI search?

How should GA4 attribution rules and channel-group precedence work for AI search?

Order is everything. A custom channel group is evaluated top to bottom, and the first matching rule wins. If a generic Referral or Organic rule sits above your AI rule, AI clicks never reach their own channel.

Use this precedence:

  • First: utm_medium exactly matches ai_search. This is authoritative. When any UTM is present, Analytics uses UTM parameters as the source of truth and derives cross-channel dimensions from them exclusively.
  • Second: a referrer host allow-list for traffic with no UTMs.
  • Third: inferred rules, flagged as lower confidence.

For the referrer rule, use a regex such as chat\.openai\.com|chatgpt\.com|perplexity\.ai|gemini\.google\.com|copilot\.microsoft\.com|claude\.ai|you\.com. Place it directly after the UTM rule and above default Referral and Organic Search.

Precedence Rule Confidence
1 utm_medium matches ai_search Highest
2 Source or referrer host matches the allow-list regex Medium
3 Inferred match (new client, AI-style landing path, short freshness window) Low

Store a confidence label with each inferred match so reporting can weight it. For a worked GA4 setup with regex examples, this partner walkthrough on tracking AI referral traffic is a useful companion.

04

What can you do when referrers or UTMs are missing?

What can you do when referrers or UTMs are missing?

Some AI surfaces open links in ways that drop both the referrer and your parameters. You need layered detection, each layer with an honest confidence score. Adobe’s documentation on derived fields for AI traffic names the main signals: user-agent identification, referrer classification and query-parameter detection.

  • Query-parameter detection (highest confidence): check for UTMs first. When a service appends parameters or you tagged the link, this is the cleanest signal available.
  • Referrer classification (medium): preserve document.referrer and match its host against a vetted registry of AI domains. Keep the registry in one shared file so client and server rules agree.
  • User-agent and server logs (medium to low): server-side logging can identify known agent and crawler patterns. It tells you an agent fetched a page, which is not always the same as a human click.
  • Inferred heuristics (lowest): combine a new client_id, a landing path that matches pages AI tends to cite, and a short freshness window. Tag these as inferred, never as confirmed.

Run the checks in this order and stop at the first hit. Then pass the confidence value downstream so your models can discount guesses. The Ahrefs AI traffic lesson also notes that some platforms pass referrers inconsistently, so supplement with a self-reported “how did you hear about us” field.

05

What naming rules keep analytics from fragmenting?

What naming rules keep analytics from fragmenting?

Fragmentation is the quiet killer of attribution. “ChatGPT”, “chatgpt” and “chat-gpt” become three rows, and nobody trusts the report.

  • Use lowercase everywhere, with hyphens for multi-word values.
  • Keep one controlled vocabulary for utm_source and reserve ai_search for utm_medium only.
  • Do not invent a medium per model. Platform granularity belongs in utm_source.
  • Document the vocabulary, generate URLs with an automated builder, add a QA step before launch, and roll out in stages.

Pro Tip: Treat the vocabulary like code. Keep it in one reviewed file, and let the URL builder reject any value that is not on the list.

06

How do you validate your tagging quickly?

How do you validate your tagging quickly?

We use the same short routine on every setup. Click-test from each agent, check the GA4 realtime report for a session carrying utm_medium=ai_search, pull a small BigQuery sample, and inspect the referrer headers on the landing request.

Four checks for validating AI agent UTMs

Watch for two pitfalls: mobile in-app webviews that strip referrers, and inconsistent source tokens across teams. Our simulation-driven checks, agent attribution analytics and the UCP Playground exist for exactly this kind of hands-on testing, so you can see how agents cite and link to your pages before you trust the numbers.

07

How do you make UTM tagging work with Shopify and WooCommerce?

How do you make UTM tagging work with Shopify and WooCommerce?

Ecommerce platforms add their own redirects, checkout hops and apps, any of which can strip or overwrite parameters. The goal is to make sure the parameters you set at the first click are still there when the order is recorded.

On Shopify, tag your outbound product URLs at the source, then verify that the landing URL after any market, language or currency redirect still carries the full query string. Check that apps handling redirects or cart attributes do not rewrite the URL. Confirm that the first-touch UTMs reach your order data, not just the session, since that is what ties AI visits to revenue.

On WooCommerce, the usual culprits are caching plugins and security layers. Configure page caching to vary by path rather than discard query strings, and make sure canonical and redirect plugins forward parameters. If you use a headless or API-driven storefront, pass UTM values through to the order metadata at checkout.

For both platforms, test one product page and one collection page from each agent, then follow the click through to a test order. Our guide to agent-driven traffic analytics covers implementation patterns and checks that fit these storefronts. If you want the attribution reporting without wiring it yourself, we connect to Shopify and WooCommerce directly.

Keep one rule across both: the medium stays ai_search, and only utm_source changes by platform.

08

How can UTM data improve your product listings for AI recommendations?

How can UTM data improve your product listings for AI recommendations?

Once AI sessions are separated cleanly, the data tells you where to work. Start by ranking landing pages by AI-attributed sessions and then by AI-attributed conversions. A page that earns AI visits but converts poorly is a listing problem. A page that converts well but gets few AI visits is a visibility problem.

Break results down by utm_source. If perplexity sends visits to a collection page while chatgpt favors individual product pages, you learn which formats each agent tends to surface. Use utm_content to separate placements and see whether structured data links outperform plain citations.

Then act on what you find. For pages with traffic and weak conversion, rewrite titles, specs and descriptions so they answer the questions shoppers bring from an AI conversation. For pages that convert but lack visits, strengthen the attributes agents read: clear materials, sizes, compatibility, shipping and return terms. Our AI product listing optimization tools are built around this loop, from diagnosing why a page loses to rewriting and publishing.

Measure changes with short, bounded tests. Change one set of pages, hold a similar set steady, and compare AI-attributed conversions over the same window. Our post on turning AI traffic into conversions goes deeper on what to do once the visits arrive.

09

What does proper UTM tagging look like in practice?

What does proper UTM tagging look like in practice?

We will not invent a customer story here, so consider a worked illustration with clearly hypothetical inputs. Say a store has two product pages that AI agents cite. Before tagging, all AI clicks land in a mix of Direct and Referral, so nobody can tell the pages apart or connect them to orders.

After the store adopts utm_medium=ai_search with controlled sources and fixes one redirect that was stripping its query string, the picture changes. The channel group now shows a distinct AI Search row. Sessions split by source reveal that one agent sends most visits to a single high-intent product page. The team sees that page has a thin description and no return policy, rewrites it, and watches AI-attributed conversions for that page across the following weeks.

The lesson is not the size of any lift. It is the sequence: tag, preserve, separate, diagnose, fix, remeasure. Without the first three steps, the last three are guesswork. Publishers can run the same logic, since OpenAI notes that ChatGPT can include utm_source=chatgpt.com in referral URLs in some flows, and that sites allowing OAI-SearchBot to crawl can track ChatGPT referrals in their analytics. Note that value, chatgpt.com, differs from your own chatgpt token, so normalize it in your reporting. For a reporting template to adapt, see our piece on measuring AI agent visibility.

10

How do you troubleshoot UTM conflicts with analytics and attribution tools?

How do you troubleshoot UTM conflicts with analytics and attribution tools?

When numbers look wrong, work from the click outward. Most problems fall into a few buckets.

Parameters vanish. Click from the agent and watch the URL at each hop. The hop where the query string disappears is your culprit: a redirect rule, a CDN setting, or a consent or security layer.

Two sources disagree. GA4 treats UTMs as authoritative when present, so a platform-assigned source can override your intended one. Check whether an agent-added parameter, such as the chatgpt.com value, is colliding with your own token, and map both to one reporting value.

Everything shows as Direct. That usually means a stripped referrer and no UTM, common in mobile in-app webviews. Use your inferred rules, label them low confidence, and add a self-reported source question to forms.

Attribution platforms overwrite tags. Some tools rewrite or re-tag landing URLs. Compare the URL the user clicked with the URL the platform logs, and exclude your AI parameters from any rewriting rule.

Mixed casing splits rows. Normalize at ingestion if you cannot fix every source at once, then fix the sources.

For GA4-side checks and extra detection examples, this partner article on tracking LLM traffic in GA4 is a helpful cross-reference. Keep a change log of every redirect, plugin and edge rule you touch. Most attribution mysteries trace back to a change nobody wrote down.

How do you troubleshoot UTM conflicts with analytics and attribution tools? — overview diagram

11

How should you prioritize agent-attribution work this quarter?

How should you prioritize agent-attribution work this quarter?

My view is that teams over-plan and under-ship. Start with your highest-traffic product and category pages and a single ai_search medium. Do not build a taxonomy of mediums, because you will not maintain it.

Automate tag injection for outputs you fully control, then extend to plugins and syndicated feeds. Resist the pull to perfect detection of untagged traffic first; tagged links give you clean data sooner.

Finally, run short A/B cohorts and measure lift in AI-attributed conversions before any broad rollout. A small, trusted result beats a large, doubtful one.

— Xhurian

12

Want to check your tagging and AI citations with ecentic?

Want to check your tagging and AI citations with ecentic?

If you want proof that your tags work, we can show you. ecentic runs simulation-driven scans that mimic ChatGPT, Gemini, Claude and other agents, showing where your product pages are cited and where competitors win instead.

Ecentic

Our UCP Playground and agent attribution analytics let you validate UTMs and surface AI-attributed conversions in one place. You get plain-English diagnostics, listing rewrite suggestions, and one-click publishing to Shopify and WooCommerce. Plans start with a free introductory scan, and paid plans are listed on our pricing page. Run a free scan or open the Playground and test your tagging today.

13

FAQ

FAQ

What utm_medium should I use for AI traffic?

Use ai_search as a single literal value on every link you control. Put platform identity in utm_source, such as chatgpt or perplexity. This keeps one clean join key for your channel group.

Does ChatGPT add UTM parameters automatically?

In some flows, yes. OpenAI says ChatGPT can include utm_source=chatgpt.com in referral URLs, per its publisher FAQ. You should still tag links you control and map the automatic value to your own token in reporting.

How do I track AI traffic when there are no UTMs?

Fall back to a referrer host allow-list, then user-agent and server-log signals, then inferred rules. Label each with a confidence level so reports can weight them. The Ahrefs lesson also suggests self-reported attribution in forms.

Why does my AI traffic show up as Direct?

Some AI surfaces and in-app webviews strip the referrer, and without a UTM nothing identifies the source. Tag links you control and add inferred rules for the rest.

14

Sources

Sources

  • Geodocs
  • Analyticsmania
  • URL builders: Collect campaign data with custom URLs - Analytics Help
  • Use derived fields to report on LLM and AI-generated traffic | Adobe Customer Journey Analytics
best practices for UTM taggingimplementing utm for agentshow to tag ai agents
Back to blogGet started

Guides and research on winning AI shopping agents.

Get picked by AI

Find out which products AI agents skip.

Install free on Shopify or WooCommerce and see your AI score in minutes.

Install on ShopifyInstall on WooCommerce
ecentic

Get the sale when AI does the shopping.

Built for the agent economy
Product
  • Features
  • How it works
  • Pricing
  • Product Listings
Platforms
  • Shopify
  • WooCommerce
  • Enterprise
Resources
  • Developer docs
  • API reference
  • Resources
  • Blog
  • Compare
  • UCP Validator
  • WebMCP scanner
  • UCP Playground
  • Book a demo
Company
  • About
  • Support
  • AI instructions
  • Privacy policy
  • Terms of service

© 2026 ecentic. All rights reserved.

Made for merchants who refuse to be invisible to AI.

ECENTIC ShPK · NIPT M61628008M · Pallatet Merkaj, Hyrja 1, Dera 12, Rruga Muhamed Deliu, Qesarakë, 1030 Tiranë, Albania · +355 68 459 4667 · support@ecentic.ai