Analytics & Events
Saltfish analytics & events
Tracking Success
Saltfish Player emits events that your application can listen to, allowing you to track engagement or trigger other actions.
// Example: Track playlist completion in your analytics tool
saltfish.on('playlistEnded', (event) => {
console.log(`Playlist ${event.playlist.id} completed by user.`);
// Send data to your analytics platform
analytics.track('Saltfish Playlist Completed', { playlistId: event.playlist.id });
});
// Example: Log when a specific step starts
saltfish.on('stepStarted', (event) => {
console.log(`User started step: ${event.step.id}`);
});playlistStarted: Fired when a playlist begins playing for the first time.playlistEnded: Fired when a playlist is fully completed.stepStarted: Fired when an individual step within a playlist begins playing.stepEnded: Fired when an individual step within a playlist ends (either by completing or transitioning away).playerPaused: Fired when the player transitions from a playing state to a paused state.playerResumed: Fired when the player transitions from a paused state back to a playing state.playerMinimized: Fired when the user minimizes the player interface.playerMaximized: Fired when the user maximizes the player interface from a minimized state.
Key API Summary for Your Developers
saltfish.init(tokenOrConfig): Initializes the player.saltfish.identify(userId, userData): Associates player usage with a specific user.saltfish.startPlaylist(playlistId, options): Launches a specific guided tour.saltfish.on(eventName, callback): Listens for player events.saltfish.off(eventName, callback): Stops listening for events.saltfish.destroy(): Shuts down the player and cleans up resources.
Last updated