Single-session
The simplest model: a student starts and completes an activity in one browser session. The client SDK tracks time and reports completion together. The frontend is the source of truth — it observed the entire activity lifecycle. Use single-session when:- Students complete the activity in one sitting (quizzes, short lessons, drills)
- The frontend has all the data it needs to report completion metrics
- You do not need to persist activity state across page reloads
Stateful/Resumable
Many apps support activities that span multiple sessions: Here, state lives in the app’s database: progress, accumulated time, and status. The frontend cannot be the sole source of truth because it was not present for all sessions. Use stateful when:- Activities span multiple days or sessions
- The backend owns progress (server-validated answers, adaptive learning)
- Students need to resume where they left off
The Key Insight
Timeback emits two types of learning events:TimeSpentEvent
“Student engaged for N seconds”Per session: Multiple events per activity run.
ActivityCompletedEvent
“Student finished with these results”Per activity: One event per activity run.
How the models differ
| Aspect | Single-session | Stateful |
|---|---|---|
| Sessions | One | Multiple |
| Time tracking | Automatic heartbeats | Automatic heartbeats |
| Completion | activity.end(...) | timeback.activity.record(...) |
| State ownership | Frontend | App database |
| Resume support | Not needed | runId persisted and reused |