Displaying Stories
Learn how to show Stories and experiments in your app using Snoopr.showStory().
Overview
Stories and experiments are displayed in your app using the Snoopr.showStory() function from the SDK.
Calling Snoopr.showStory()
To display Stories in your app, call Snoopr.showStory():
import { Snoopr } from 'react-native-snoopr'
Snoopr.showStory()With Options
You can pass options to control behavior and handle callbacks:
Snoopr.showStory({
showOnlyOnce: true, // Default: true
onFinish: (response) => {
console.log('Story completed', response)
},
onDismiss: () => {
console.log('Story dismissed')
}
})Options Reference
| Option | Type | Default | Description |
|---|---|---|---|
showOnlyOnce | boolean | true | If true, story only shows once per app. If false, story shows every time this is called. |
onFinish | (response: StoryResponse) => void | - | Callback when story completes |
onDismiss | () => void | - | Callback when story is dismissed |
showOnlyOnce Behavior
true(default): The story displays once per app installation. Subsequent calls toshowStory()will not display the story again.false: The story displays every timeshowStory()is called.
How Targeting Works
Targeting is not configured separately. When you create an experiment in the Snoopr dashboard, traffic allocation happens automatically. The SDK handles which users see which variant based on this allocation.
Best Practices
- Place your
Snoopr.showStory()call at the appropriate point in your app's user flow - Use
onFinishto trigger post-onboarding actions - Use
onDismissto handle early exits gracefully - Monitor experiment results in Analytics to see how different variants perform
Related
- Publishing & Going Live - Manage story statuses and traffic allocation
For Developers: See the Snoopr API Reference for full showStory() documentation.