Add comprehensive visitor engagement tracking and scroll-to-top on navigation
Tracks scroll depth (25/50/75/90%), time on page, UTM parameters, outbound link clicks, search queries, audio pause/completion/listen time, and 404s. Logged-in study users are now tied to their visitor record and surfaced in the admin recent visits table. Scroll position resets on every route change. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -63,6 +63,27 @@ export const state = {
|
||||
episodePlays: {},
|
||||
episodePlaysWritePromise: Promise.resolve(),
|
||||
|
||||
// analyticsEvents: aggregated engagement data from frontend events
|
||||
// {
|
||||
// scrollDepth: { [path]: { 25: n, 50: n, 75: n, 90: n } }
|
||||
// timeOnPage: { [path]: { totalSeconds: n, count: n } }
|
||||
// outboundClicks: { [url]: n }
|
||||
// utmSources: { [utm_source]: n }
|
||||
// searchQueries: { [query]: n }
|
||||
// notFound: { [path]: n }
|
||||
// audioEvents: { [title]: { pauses: n, completions: n, totalListenSeconds: n } }
|
||||
// }
|
||||
analyticsEvents: {
|
||||
scrollDepth: {},
|
||||
timeOnPage: {},
|
||||
outboundClicks: {},
|
||||
utmSources: {},
|
||||
searchQueries: {},
|
||||
notFound: {},
|
||||
audioEvents: {},
|
||||
},
|
||||
analyticsEventsWritePromise: Promise.resolve(),
|
||||
|
||||
// qrCodes: Array<{ id, slug, label, destination, createdAt }>
|
||||
// qrScans: Array<{ id, qrId, slug, scannedAt, ip, userAgent }>
|
||||
qrCodes: [],
|
||||
|
||||
Reference in New Issue
Block a user