Event Tracking¶
Events are the foundation of Dxtra Tag Manager's rule engine. Every interaction -- a page view, a button click, a form submission -- is captured as an event that can trigger rules and record analytics data.
Built-in Events¶
Tag Manager automatically tracks these events without additional configuration:
| Event | When It Fires | Data Included |
|---|---|---|
| Page View | Every page load (and SPA route change if enabled) | Page URL, title, referrer |
| Page Loaded | When the DOM is fully loaded | Page URL, load timing |
| CMP Check | When consent status is evaluated | Consent category values |
Custom Events¶
Track business-specific interactions using the analytics API:
Naming Conventions¶
Use consistent, descriptive event names:
| Pattern | Example | Use For |
|---|---|---|
noun_verb | form_submitted, button_clicked | User interactions |
item_action | product_viewed, cart_updated | E-commerce actions |
process_step | checkout_started, signup_completed | Funnel tracking |
Common Custom Events¶
E-commerce:
window.dxtraAnalytics.track('product_viewed', {
product_id: 'SKU-123',
product_name: 'Widget Pro',
category: 'Electronics'
});
window.dxtraAnalytics.track('purchase_completed', {
transaction_id: 'T-12345',
value: 99.99,
currency: 'USD'
});
Lead generation:
window.dxtraAnalytics.track('form_submitted', {
form_name: 'contact_us',
form_type: 'lead'
});
Content engagement:
window.dxtraAnalytics.track('file_downloaded', {
file_name: 'whitepaper.pdf',
file_type: 'pdf'
});
Using Events in Rules¶
Events trigger rules. When configuring a rule in the Tag Manager dashboard:
- Select the Event that should trigger the rule (built-in or custom)
- Optionally add Conditions to narrow when the rule fires
- Define Actions to execute when the rule matches
Example rule:
Event: Page View
Condition: Page URL contains "/pricing"
Action: Track Event "pricing_page_viewed"
Event Properties¶
Event properties are key-value pairs that provide context. Properties can be used in rule conditions and are stored with the event in analytics.
window.dxtraAnalytics.track('signup_completed', {
plan: 'growth', // String
trial_days: 14, // Number
referral: true // Boolean
});
Access event properties in rule conditions using the data layer inspector.
SPA Event Tracking¶
For single-page applications, enable SPA tracking in the script URL:
This automatically fires Page View events on route changes. For hash-based routing, use ?opts=spa,hash.
For frameworks that need manual page view tracking:
// Call after each route change
window.dxtraAnalytics.track('page_view', {
page_location: window.location.href,
page_title: document.title
});
Debugging Events¶
Use the debug overlay (#dxtra-debug) to monitor events in real time. The Events tab shows:
- Every event as it fires
- Event properties and data
- Which rules the event triggered
- Timestamps for all activity
Best Practices¶
- Use consistent event naming across your site for clean analytics data
- Include relevant properties but avoid sending personal data in event properties
- Test events in debug mode before publishing to production
- Document your event schema so your team knows what events exist and their properties
- Avoid excessive custom events -- track meaningful interactions, not every mouse movement
Continue to Global Triggers to learn about reusable trigger configurations.