Overview
The Timeback SDK provides Svelte stores, components, and initialization for client-side integration.Installation
Setup
Initialize Timeback in your root layout:src/routes/+layout.svelte
Stores
timeback
Access the Timeback client:
timebackVerification
Check authentication status:
status property that can be:
'loading'- Verification in progress'verified'- User is verified (includestimebackId)'unverified'- User is not verified'error'- Verification failed (includesmessage)
timebackProfile
Fetch user profile data:
Components
SignInButton
Pre-built sign-in button:
Props
Button size
Button style variant
Show loading spinner on click
Show Timeback logo
Disable the button
Custom Activities
The SDK supports two activity models that capture how students spend time in your app and whether they complete what they started, producing TimeSpentEvents and ActivityCompletedEvents that feed into dashboards, XP, and learning analytics.Single-session
A quiz, flashcard deck, or short lesson that a student completes in one sitting. The client tracks time and reports completion. Learn more about single-session activities.Stateful
A multi-part course or long-form project where students leave and come back across multiple sessions. The client tracks time per visit while the server records completion. Learn more about stateful activities.Next Steps
SvelteKit Server
Server-side setup
Custom Activities
Learn more about tracking