Event Tracking
PennyLens captures common user interactions automatically, and exposes a small API for custom events.
Auto-tracked events
Once the SDK loads, PennyLens captures the following without any configuration:
- Pageviews — URL changes, including SPA route transitions
- Clicks — element path, text, page coordinates (for heatmaps)
- Scroll depth — per-page scroll % bucketed by viewport
- Mouse movement — density for attention heatmaps
- Form interactions — focus, completion, abandonment, submission
- Errors — uncaught JavaScript errors and rejected promises
Custom events
Track business-specific actions:
PennyLens.track("checkout_started", {
cart_value: 89.99,
item_count: 3,
});
Event names should be lowercase with underscores. Properties are optional and can be any JSON-serializable value.
User identification
Link anonymous sessions to known users once they sign in:
PennyLens.identify("user-123", {
email: "user@example.com",
plan: "pro",
});
All future events from this session are attributed to user-123.
Privacy controls
Input masking
By default, all form inputs are masked in session recordings. No setup required.
Ignore specific elements
Add data-pl-ignore to exclude any element from recording:
<div data-pl-ignore>
Sensitive content won't appear in recordings
</div>
Consent mode
If you need opt-in tracking (GDPR/CCPA), pause the tracker until the user accepts:
PennyLens.pause();
// After the user accepts:
PennyLens.resume();
Next steps
- API Reference — data model and integration details