Overview
Google Tag Manager (GTM) provides a flexible way to deploy Trodo without modifying your website’s source code. This guide covers setup, configuration, and best practices.Quick Setup
Open Google Tag Manager
Go to tagmanager.google.com and select your container
Add Trodo Script
Paste the following code:Replace
YOUR_SITE_ID with your actual Site ID from Trodo dashboard.Configuration Options
Basic Configuration
Full Configuration
Configuration Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
site-id | string | required | Your Trodo site identifier |
auto-events | boolean | true | Enable automatic event tracking |
auto-events-disabled-paths | string | '' | Comma-separated URL paths to exclude |
auto-events-disabled-events | string | '' | Comma-separated auto-events to disable |
Using GTM Variables
You can use GTM variables in your configuration:Site ID from Variable
- Create a Constant variable for your Site ID
- Reference it in the tag:
Environment-Based Configuration
Use GTM’s environment feature for staging vs production:Custom Event Tracking
Via Data Layer
Push events to GTM’s data layer, then forward to Trodo: On your website:trodo_event
Direct Tracking
After Trodo loads, you can track directly:User Identification
Identify Users via GTM
Create a tag to identify users when they log in:user_logged_in
Custom product events
FireTrodo.track() from a tag when a data layer event occurs (for example activation or agent completion):
agent_run_completed)
Trigger Configurations
All Pages (Recommended)
Load Trodo on every page:- Trigger Type: Page View
- Trigger fires on: All Page Views
Specific Pages Only
Load only on certain pages:- Trigger Type: Page View
- Trigger fires on: Some Page Views
- Condition:
Page Pathcontains/app
Exclude Pages
Exclude admin or internal pages:- Create trigger: Page View - Some Page Views
- Condition:
Page Pathdoes not contain/admin - AND
Page Pathdoes not contain/internal
Consent-Based Loading
Load only after consent:- Trigger Type: Custom Event
- Event name:
consent_granted
Tag Sequencing
Load Order
Ensure Trodo loads before dependent tags:- Open your Trodo tag
- Go to Advanced Settings → Tag Sequencing
- Check “Fire a tag before [Trodo] fires” if needed
- Check “Fire a tag after [Trodo] fires” for dependent tags
Wait for Trodo
For tags that depend on Trodo:Debugging
GTM Preview Mode
- Click Preview in GTM
- Navigate to your website
- GTM debug panel shows:
- Tag firing status
- Variable values
- Data layer events
Verify Trodo Loading
In browser console:Network Tab
Check for requests to:cdn.trodo.ai(script load)api.trodo.ai(event tracking)
Common Issues
Tag not firing
Tag not firing
- Check trigger conditions in GTM Preview
- Verify container is published
- Check for JavaScript errors in console
Events not appearing in Trodo
Events not appearing in Trodo
- Verify Site ID is correct
- Check domain is whitelisted in Trodo
- Look for blocked requests (ad blockers)
- Verify in Network tab that API calls succeed
Double tracking
Double tracking
- Ensure Trodo is only loaded once
- Check for duplicate tags in GTM
- Don’t load via both GTM and direct script
Script blocked by CSP
Script blocked by CSP
Add to your Content Security Policy:
Best Practices
Use Folders
Organize your Trodo tags:Naming Convention
Use clear, consistent names:Version Control
Use GTM’s built-in versioning:- Add descriptions to each version
- Name versions meaningfully: “Added Trodo tracking”
- Use workspaces for team collaboration
Testing
Always test before publishing:- Use GTM Preview mode
- Test on staging environment first
- Verify events appear in Trodo
- Check for console errors
Next Steps
Auto-Events
Configure automatic tracking
SDK Reference
Track custom events