feat: manage engament time depending on simulator#873
Conversation
a9191da to
0a661a1
Compare
There was a problem hiding this comment.
Pull request overview
Updates engagement (“Temps”) tracking timing so it varies by simulator context (notably Transport, based on route and defaultMode), and aligns tracking labels for Livraison “étiquette” iframes.
Changes:
- Added per-simulator timing configuration in
TrackingProvider, including Transport-specific logic using pathname and query params. - Updated the Livraison “étiquette animée” iframe page to use the accented tracking label (
Livraison étiquette).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/providers/TrackingProvider.tsx | Introduces a timing map and uses pathname/searchParams to compute engagement timeout (esp. Transport). |
| app/(iframes)/iframes/livraison/etiquette-animee/page.tsx | Renames the tracking string to Livraison étiquette for consistency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let timing = trackingTime[tracking] || 15000 | ||
| if (typeof timing !== 'number') { | ||
| timing = timing(pathname, params) | ||
| } | ||
| timeoutRef.current = setTimeout(() => { | ||
| trackOnce('Temps') | ||
| }, timing) |
There was a problem hiding this comment.
In the intersecting branch, this effect can run multiple times while the element stays visible (e.g., because pathname/params change or the observer emits a new entry). A new timeout is scheduled each time without clearing any previously scheduled timeout, leaving orphan timers that will still fire later. Clear any existing timeoutRef.current before calling setTimeout (and consider whether the fallback timing should really be 15000ms now—previously non-"etiquette" tracking defaulted to 45000ms, so this changes engagement metrics for any tracking key not explicitly handled).
a16ee7f to
940ef9c
Compare
940ef9c to
65049de
Compare
No description provided.