Appearance
Reference
Global SDK object
The hosted script exposes a global trainingkit object.
Methods
trainingkit.init(baseUrl)
Initializes the SDK with your TrainingKit base URL.
js
trainingkit.init('https://cloud.YourCompany.fizzup.com')trainingkit.start(options)
Starts a workout session.
js
trainingkit.start({
workoutId: '4RGZ7S46',
soundpack: 'none',
getAccessToken: async function () {
return 'your-access-token'
},
onWorkoutQuit: function () {},
onWorkoutSave: function (workoutData) {},
onWorkoutEvent: function (action, payload) {},
})Options
| Field | Required | Description |
|---|---|---|
workoutId | Yes | TrainingKit workout identifier to launch |
soundpack | No | Sound theme for the workout experience |
getAccessToken | No | Async callback returning a backend-issued access token |
onWorkoutQuit | No | Callback called when the user quits the workout |
onWorkoutSave | No | Callback called when workout data is saved |
onWorkoutEvent | No | Generic callback receiving event name and payload |
Completion listeners
Register the workout listeners in the same trainingkit.start call that launches the workout:
js
trainingkit.start({
workoutId: '4RGZ7S46',
onWorkoutSave: function (workoutData) {
// Persist the completed workout result.
},
onWorkoutQuit: function () {
// The user exited before completing the workout.
},
onWorkoutEvent: function (action, payload) {
// Forward TrainingKit analytics metadata if needed.
},
})| Listener | Trigger | Payload |
|---|---|---|
onWorkoutSave(workoutData) | The workout completed and produced session state. | Workout result data to persist in your app or backend. |
onWorkoutQuit() | The user closed the workout without completing it. | None. |
onWorkoutEvent(action, payload) | TrainingKit emitted a tracking event. | Event name plus event properties. |
trainingkit.close()
Closes the TrainingKit iframe.
js
trainingkit.close()Supported soundpacks
Based on the current example flow:
nonezenoriginalnewwhistle
