Skip to content

feat: manage engament time depending on simulator#873

Merged
desoindx merged 1 commit into
developfrom
feat/engagement
Mar 31, 2026
Merged

feat: manage engament time depending on simulator#873
desoindx merged 1 commit into
developfrom
feat/engagement

Conversation

@desoindx
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings March 30, 2026 13:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +71 to +77
let timing = trackingTime[tracking] || 15000
if (typeof timing !== 'number') {
timing = timing(pathname, params)
}
timeoutRef.current = setTimeout(() => {
trackOnce('Temps')
}, timing)
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
@desoindx desoindx force-pushed the feat/engagement branch 5 times, most recently from a16ee7f to 940ef9c Compare March 31, 2026 16:10
@desoindx desoindx merged commit a7caa43 into develop Mar 31, 2026
6 checks passed
@desoindx desoindx deleted the feat/engagement branch March 31, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants