Experiment events are lost when a visitor leaves within flushInterval (no flush on pagehide)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, playwright, react, typescript, vite
- Ambito
- analytics, backend-api-design
Direzione di ricerca
Start by locating the event processor and its flush interval behavior; the issue does not name source files or tests. Reproduce the reported short-visit case in the Playwright browser setup, then inspect how page lifecycle events and event delivery are handled. Done means exposures and conversions are delivered when a visitor leaves before the interval, with regression coverage for that case.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: @flagsmith/flagsmith 12.6.0 (latest), browser, Experimentation with enableEvents: true.
What happens: the event processor buffers exposures and trackEvent calls and sends them every flushInterval (default 1e4, 10 seconds). Nothing flushes the buffer when the page is hidden or closed: there is no pagehide / visibilitychange handler, and the request doesn't use keepalive or navigator.sendBeacon. A visitor who leaves within 10 seconds never reaches the experiment, and neither does a conversion made just before leaving.
How we saw it: we ran 40 scripted browser visits (Playwright, real Chromium) through an experiment on a React + Vite app wired with FlagsmithProvider, getExperimentFlag and trackEvent. Each visit lasted 3–6 seconds.
| Visits | Exposures recorded |
|---|---|
3–6 s, default flushInterval |
0 of 40 |
11 s, default flushInterval |
40 of 40 |
3–6 s, eventProcessorConfig: { flushInterval: 1000 } |
40 of 40 |
Same app, same build, same Flagsmith instance; only the visit length or the interval changed. The app also called flagsmith.flushEvents() from a pagehide listener; with visits that end by closing the page, that didn't deliver the events either.
Why it matters for experiments: if one variant makes people leave sooner, that arm loses more exposures and conversions than the other, so the result is biased, and the sample ratio may still look fine.
Suggestion: flush on pagehide (and visibilitychange to hidden) with fetch(url, { keepalive: true, ... }) or navigator.sendBeacon, and consider a shorter default interval for experiment exposures. Until then, a line about flushInterval in the Experimentation docs and the coding-agent set-up prompt would save people from this.
- Lingua principale
- TypeScript
- Stelle
- 67
- Fork
- 47
- Merge medio
- 1g 5h
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Flagsmith/flagsmith-js-client
-
`init({ traits })` double-wraps `{ value, transient }` trait objects, sending a nested `trait_value`Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Flagsmith/flagsmith-js-client#444 ·
-
Dependency DashboardAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 20/100
Flagsmith/flagsmith-js-client#435 ·
-
Move module-scope Emitter in react.tsx into the ProviderForse già presa @EngineerOnTravel l’ha presa 101 giorni fa. Apertabug good first issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
Flagsmith/flagsmith-js-client#391 · 1 commento ·
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
Flagsmith/flagsmith-js-client#371 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Flagsmith/flagsmith-js-client#330 ·
Tutte le issue di Flagsmith/flagsmith-js-client
Issue simili
-
ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
mermaid-js/mermaid-v13#1370 ·
I maintainer di solito rispondono entro 1 giorno
-
compiler: the island_chunks_not_emitted report gives a count but not which islands were skippedApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Broken Website
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
darkreader/darkreader#16259 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ARTPARK-SAHAI-ORG/calibrate-frontend#919 ·
I maintainer di solito rispondono entro 1 giorno