Gain full visibility into traffic originating from Large Language Models (LLMs) such as ChatGPT, Google Gemini, Perplexity AI, Microsoft Copilot, and Claude.
This Google Tag Manager (GTM) template allows you to detect, segment, and control LLM-influenced traffic within your analytics and performance marketing ecosystem.
As AI models increasingly browse the live web, your GA4 data and attribution models can become skewed by non-human interactions. This tool empowers you to:
- Filter AI Traffic: Keep your conversion rates and engagement metrics clean.
- GA4 Segmentation: Create dedicated audiences or segments for LLM sessions.
- Advanced Attribution: Ensure your marketing spend is evaluated against real human behavior.
- Server-Side Ready: Fully compatible with Server-side GTM (sGTM), especially when using TAGGRS.
- ✅ Smart Detection: Identifies bots and crawlers from major AI providers via User-Agent analysis.
- ✅ Boolean Logic: Outputs a simple
true(AI traffic) orfalse(Human traffic). - ✅ Lightweight: Designed for performance with zero dependencies.
- ✅ Seamless Integration: Works as a standard GTM variable for use in any tag or trigger.
- From Gallery (Recommended): In GTM, go to Templates → Search Gallery. Search for "LLM Traffic Detector" and click Add to Workspace.
- Manual: Download the
LLM Traffic Detector.templatefile from this repository and import it under the Templates section.
- Navigate to Variables → New → User-Defined Variables.
- Select LLM Traffic Detector as the variable type.
- Name it (e.g.,
{{LLM Traffic Detector}}) and Save.
- In Triggers: Use a condition like
{{LLM Traffic Detector}} equals falseto ensure a tag only fires for human visitors. - In Tags: Pass the variable into GA4 as a User Property or Event Parameter (e.g.,
is_llm_traffic) to enable session-level segmentation.
- Enter GTM Preview mode.
- Spoof an LLM User-Agent using browser DevTools (e.g., set your Network conditions to
Mozilla/5.0... GPTBot). - Verify that the variable output shows
true. - Once verified, Publish your container.
| Setting | Value |
|---|---|
| Event Type | Custom Event / Page View |
| Trigger condition | {{LLM Traffic Detector}} equals false |
Pass the boolean value to your server-side container to enable advanced attribution filtering and prevent AI "noise" from reaching your marketing pixels.
- Google Tag Manager container (Client-side or Server-side).
- For sGTM: A TAGGRS setup is recommended for enhanced tracking accuracy and server-side processing.
Contributions are welcome! If you encounter a new AI bot that isn't being detected yet, please open an Issue or submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Maintained by TAGGRS