Overview
TheTrackClick component wraps your UI elements to automatically track click interactions. It captures click coordinates and target information, making it ideal for tracking button clicks, link interactions, and user engagement.
Props
The content to render and track clicks for.
The event name to track when the element is clicked.
Additional properties to include with the tracked event.
Identifier for the element being tracked. Defaults to “unknown”.
Usage
Basic Usage
Track Navigation Links
Track Card Interactions
Automatic Properties
In addition to your custom properties,TrackClick automatically includes:
target- The HTML tag name of the clicked elementx- The X coordinate of the click (clientX)y- The Y coordinate of the click (clientY)
Behavior
- Wraps children in a
<div>element with click handler - Captures click coordinates relative to viewport
- Merges automatic properties with custom properties
- Does not prevent default click behavior or stop propagation
Use Cases
- Track button clicks and conversions
- Monitor navigation patterns
- Analyze user engagement with UI elements
- A/B test different call-to-action variants
- Measure feature adoption
- Build click heatmaps