Automatic Event Tracking
Enable automatic tracking in your dashboard under Settings → Tracker → Features. No code changes required.| Feature | What It Tracks | Events Generated |
|---|---|---|
| Form Tracking | All form submissions and abandonments | $form_submit, $form_abandon |
| Click Tracking | Link and button clicks, plus data-track-event elements | Click events |
| Download Tracking | File downloads (.pdf, .docx, .zip, .xlsx, etc.) | Download events |
Recommended: Enable all three for comprehensive tracking without writing any code. You can always add custom events later for specific use cases.
What Gets Tracked Automatically
With Form Tracking enabled:- Form submissions (with form ID, action URL, and field names)
- Form abandonment (when users start but don’t complete forms)
- All link clicks (with href, text, and position)
- Button clicks
- Elements with
data-track-eventattribute (see Declarative Tracking)
- PDF, Word, Excel, PowerPoint downloads
- ZIP, RAR, and other archive files
- Any link with a
downloadattribute
Custom Events
For business-specific actions not covered by automatic tracking, use theSnitcher.track() method.
When to Use Custom Events
| Use Automatic Tracking | Use Custom Events |
|---|---|
| Form submissions | Demo requests with custom fields |
| General click tracking | Pricing plan selection |
| File downloads | Video engagement (play, complete) |
| Link navigation | In-app feature usage |
| Purchases and conversions | |
| A/B test interactions |
The track Method
The name of the event. Use
[Object] [Action] format (e.g., “Trial Started”, “Plan Selected”).Additional context about the event.
Examples
Track a demo request with business context:Declarative Click Tracking
For simple click tracking, you can use HTMLdata-* attributes instead of writing JavaScript. This is perfect for marketing sites, CMS-managed content, or anywhere you want to track clicks without code changes.
The data-track-event Attribute
Add data-track-event to any element to make it trackable:
Adding Custom Properties
Include additionaldata-* attributes to pass properties with the event:
Property names are automatically converted from
kebab-case to camelCase. So data-button-location becomes buttonLocation.Common Examples
Tracking navigation clicks:When to Use Declarative vs JavaScript Tracking
Use Declarative (data-track-event) | Use JavaScript (Snitcher.track()) |
|---|---|
| Simple click tracking | Complex event logic |
| Static HTML / CMS content | Dynamic values from state |
| No JavaScript access | Need to track non-click events |
| Marketing pages | Application interactions |
Requires Click Tracking: Enable click tracking in Settings → Tracker → Features for declarative tracking to work.
Event Naming Best Practices
Do
- Use
[Object] [Action]format - Be specific: “Pricing Plan Selected”
- Use consistent capitalization
- Keep names concise
Don't
- Don’t use vague names: “Clicked”
- Don’t include dynamic data in event names
- Don’t use special characters
- Don’t exceed 100 characters
Good Event Names
Property Guidelines
- Use
snake_casefor property names - Keep values short and meaningful
- Include context: page URL, button location, user action
- Don’t include PII (emails, names) unless necessary
Viewing Events in Snitcher
Custom events appear in:- Company Timeline: See all events from a specific company
- Session Details: View events within a visitor session
- Segments: Create segments based on custom events
Flush Events Immediately
By default, events are batched and sent periodically. To send immediately (useful before navigation):React / Vue / SPA Integration
For single-page applications, track events normally—the tracker handles client-side navigation automatically:Event Listeners
Snitcher emits events that you can listen to for custom integrations, debugging, or triggering other actions.The on Method
Subscribe to tracker events:
Available Events
| Event | Fired When |
|---|---|
initialized | Tracker finishes loading |
pageview | A pageview is tracked |
identify | A user is identified |
track | A custom event is tracked |
form_submit | A form submission is captured |
click | A click is tracked (when enabled) |
Examples
Wait for tracker to initialize:One-Time Listeners
Useonce to listen for an event only once:
Remove Listeners
Useoff to remove a listener:
Event listeners are useful for integrating Snitcher with other tools, debugging, or building custom analytics dashboards.
Debugging
Open your browser’s Developer Tools to see event tracking in action:- Go to the Network tab
- Filter by
radar.snitcher.com - Click on requests to see event payloads
Debug Mode
Enable debug mode to see detailed logs in the console:- Tracker initialization
- Every event sent
- Any errors encountered