Triggers
Event triggers and firing conditions in Google Tag Manager.
Triggers Overview
Triggers determine when your tags fire. Without the right triggers, even perfectly configured tags won't work correctly.
Trigger Logic
Trigger = Event + Conditions
Event: What happened (page load, click, form submit)
Conditions: Additional filters (specific pages, elements, values)
Tag fires when:
Event occurs AND all conditions are trueTrigger Types at a Glance
| Type | Use Case | |------|----------| | Page View | Track page loads | | Click | Track user clicks | | Form Submission | Track form completions | | Scroll Depth | Track how far users scroll | | Element Visibility | Track when elements appear | | YouTube Video | Track video engagement | | Timer | Track time on page | | Custom Event | Track custom interactions | | History Change | Track SPA navigation |
Page View Triggers
Three Page View Options
1. Page View (gtm.js)
├── Fires immediately when GTM loads
├── Before page fully renders
└── Use for: Config tags, early tracking
2. DOM Ready (gtm.dom)
├── Fires when DOM is fully parsed
├── Before images/external resources load
└── Use for: Element-dependent tags
3. Window Loaded (gtm.load)
├── Fires when everything loads
├── Images, scripts, styles complete
└── Use for: Performance trackingPage View with Conditions
Fire only on specific pages:
Trigger Type: Page View
Condition: Page Path contains /checkout
Fire on multiple pages:
Condition: Page Path matches RegEx ^/(cart|checkout|thank-you)Click Triggers
All Elements vs Just Links
All Elements Click:
├── Any clickable element
├── Buttons, divs, spans, images
└── Most flexible option
Just Links Click:
├── Only <a> elements
├── Waits for link validation
└── Better for outbound trackingClick Variables Available
| Variable | Description | |----------|-------------| | Click Element | The clicked DOM element | | Click Classes | CSS classes on element | | Click ID | ID attribute of element | | Click Target | Target attribute (links) | | Click URL | href value (links) | | Click Text | Text content of element |
Common Click Trigger Examples
Track button by ID:
Trigger: All Elements
Condition: Click ID equals "submit-form"
Track by CSS class:
Trigger: All Elements
Condition: Click Classes contains "add-to-cart"
Track outbound links:
Trigger: Just Links
Condition: Click URL does not contain yourdomain.com
Track tel: links:
Trigger: Just Links
Condition: Click URL starts with tel:Form Triggers
Form Submission Trigger
Fires when a form is submitted
Works with most form types
Can wait for AJAX validation
Configuration:
├── Wait for Tags: Check if using redirects
├── Check Validation: Wait for form validation
└── Enable for all forms or specific onesForm Variables
| Variable | Description | |----------|-------------| | Form Element | The form DOM element | | Form Classes | CSS classes on form | | Form ID | ID attribute of form | | Form Target | Target attribute | | Form URL | Action URL | | Form Text | Text within form |
Form Trigger Best Practices
For standard forms:
├── Use Form Submission trigger
├── Enable "Check Validation"
├── Wait for Tags if redirecting
For AJAX forms:
├── Form Submission may not work
├── Use Custom Event instead
├── Developer pushes event after successCustom Event Triggers
Custom events are the most powerful trigger type—they react to events you define via the data layer.
How Custom Events Work
// Developer pushes event to data layer
dataLayer.push({
event: 'formSubmitSuccess',
formName: 'Contact Form',
formLocation: 'Homepage'
});
// GTM trigger fires on 'formSubmitSuccess'Creating Custom Event Trigger
Trigger Type: Custom Event
Event Name: formSubmitSuccess (exact match)
With conditions:
Event Name: formSubmitSuccess
Condition: formName equals "Contact Form"Common Custom Events
| Event Name | Use Case | |------------|----------| | formSubmitSuccess | Successful form submission | | loginSuccess | User logged in | | addToCart | Product added to cart | | checkout | Checkout initiated | | purchase | Purchase completed | | videoComplete | Video watched to end | | tabClick | Tab navigation |
RegEx for Multiple Events
Match multiple events with one trigger:
Event Name matches RegEx: ^(addToCart|removeFromCart|updateCart)$
This fires for:
├── addToCart
├── removeFromCart
└── updateCartAdvanced Triggers
Scroll Depth Trigger
Track how far users scroll:
├── Vertical Scroll Depths: 25, 50, 75, 90
├── Horizontal Scroll Depths: (optional)
├── Units: Percentages or Pixels
Outputs {{Scroll Depth Threshold}} variable
Example: Fire GA4 event at 90% scrollElement Visibility Trigger
Fire when element appears in viewport:
├── Selection Method: ID, CSS Selector
├── When to fire: Once per page/element
├── Minimum visible: 50% (recommended)
├── Minimum on-screen: 1000ms (optional)
Use for:
├── Lazy-loaded content tracking
├── Ad impression tracking
├── Section engagementYouTube Video Trigger
Built-in YouTube tracking:
├── Start
├── Complete
├── Pause, Seek, Buffering
├── Progress: 10%, 25%, 50%, 75%
Requirements:
├── YouTube IFrame API support
├── Enable JavaScript API in embed URLTimer Trigger
Fire after time elapsed:
├── Interval: 30000 (30 seconds)
├── Limit: 1 (fire once)
├── Enable on: specific pages only
Use for:
├── Engaged session tracking
├── Time-on-page events
├── Delayed popups/tagsHistory Change Trigger
For Single Page Applications (SPAs):
├── Fires when URL changes without page reload
├── Captures React/Vue/Angular navigation
├── Essential for SPA pageview tracking
Variables available:
├── New History Fragment
├── New History State
├── Old History Fragment
├── Old History StateTrigger Groups
Fire tag only when multiple triggers occur:
Trigger Group = Trigger A + Trigger B
Example:
Fire after user scrolls 50% AND spends 30 seconds
Setup: Triggers → New → Trigger GroupPro Tip: Always test triggers in Preview mode before publishing. Use the "Tags Fired" and "Tags Not Fired" sections to verify your conditions work exactly as expected.