@adpharm/silo-analytics
v1.0.6
Published
Custom Segment wrapper with automatic Time on Page tracking
Readme
@adpharm/silo-analytics
A drop-in replacement for @segment/analytics-next that adds automatic Time on Page tracking with built-in guardrails for SPAs (React Router) and SSR environments.
Features
- Zero-Config Tracking: Automatically tracks
Page Time Spentevents. - SPA Ready: Smartly handles internal route changes (React Router) by listening to Segment
pageevents. - Tab & Visibility Aware: Accurately pauses/resumes tracking when users switch tabs or minimize the browser.
- Data Quality Guardrails:
- 3s Threshold: Ignores "bounces" (stays under 3 seconds).
- 15m Cap: Prevents skewed data from "zombie tabs" by capping events at 900 seconds.
- Reliable Delivery: Uses
pagehideandvisibilitychangepatterns to ensure data is sent before the page unloads.
Installation
Remove the standard Segment package and replace it with this wrapper:
bun remove @segment/analytics-next
bun add @adpharm/silo-analytics