createUserJourneysInterviews
Creates a wrapper around your existing analytics client and returns link handling utilities.The Interviews public SDK key from Settings -> API Keys. It is scoped to
loading interview triggers and launching eligible in-app interviews.
Your stable person id. Use the same id you use for your analytics person id,
such as a Mixpanel
distinct_id, or your canonical user id.Optional override for opening the server-provided browser interview URL.
Defaults to React Native
Linking.openURL.Optional allowlist mapper for event properties. Only JSON primitive metadata is
accepted.
Optional app-level primitive metadata added to eligible event and link launch requests.
Optional low-level diagnostics for logging config loads, ignored events,
fallbacks, and WebView bridge errors.
wrapTrackClient
Wraps a client that already exposes atrack(eventName, properties, ...extraArgs)
method, such as the Mixpanel React Native client or an app-owned analytics
helper with the same method shape.
track properties pass through unchanged. The original analytics call still
runs first, and the wrapper preserves the track return value. UserJourneys
receives the event name and mapped context in the background and decides whether
to create a pending invite. UserJourneys config, API, or network failures are
reported through onDiagnostic; they do not change the wrapped analytics
return value.
If your analytics provider uses a different event method, call that provider and
then call interviews.track(eventName, properties) from the same analytics
helper instead of using wrapTrackClient.
The SDK does not call UserJourneys for every analytics event. It loads the
active trigger config for the project, caches it for the server-provided TTL,
ignores unrelated events locally, and only resolves matching events with the
server.
Matching events do not open the interview immediately. They set
snapshot.pendingInvite. By default, UserJourneysInterviewHost renders the
prompt for that invite.
useUserJourneysInterviews
Subscribes to the SDK snapshot so you can render a custom native prompt. When using a custom prompt, mountUserJourneysInterviewHost with
showPrompt={false}.
pendingInvite is set after an eligible analytics event or synced audience
match. activeLaunch is set when an invite starts or an explicit link opens
in-app.
startPendingInvite
Starts the current pending invite.webview means the full-screen host can render the in-app interview.
external_browser means the SDK opened the fallback URL. expired means the
signed launch expired before the user accepted. not_eligible means the server
declined the launch after the user accepted a pending audience prompt. none
means no pending invite was available or launch resolution failed without
breaking the app.
dismissPendingInvite
Clears the current pending invite without opening the interview.handleUserJourneysLink
Handles HTTPS invite links from Intercom, email, push, or any other channel.https://app.userjourneys.ai/i/{inviteCode}https://app.userjourneys.ai/interviews/{inviteCode}
UserJourneysInterviewHost
Mounts the built-in prompt and full-screen WebView host.The client returned by
createUserJourneysInterviews.Optional app-controlled visibility gate. The host still requires an active
pending invite or active server launch decision.
Controls whether the built-in pending-invite prompt is rendered. Defaults to
true. Set to false when rendering your own prompt with
useUserJourneysInterviews.Optional extra origins that the WebView may navigate to. The launch and fallback
origins are allowed automatically.
Called when the web interview reports that the embed loaded.
Called when the interview session starts.
Called when the session completes.
Called when the participant leaves before completion.
Called when the participant closes the in-app interview.
Called for WebView load failures, invalid bridge messages, blocked navigation,
or interview runtime errors reported by the embed.
referenceId and triggerEvent
referenceId answers who the respondent is. Use your analytics person id or
canonical user id.
triggerEvent answers what app event opened the interview. It is attribution
context; UserJourneys targeting and eligibility are server-controlled.
Attribution fields
SDK snapshots and callbacks can include these server-provided attribution fields:The Study Launch Rule that created the pending invite or launch.
The study that UserJourneys selected for the launch.
The synced audience that matched the current
referenceId, when the launch
started from an audience prompt.Public API boundary
The SDK uses two versioned public endpoints:GET /api/v1/interview-participant/configPOST /api/v1/interview-participant/launches
config returns server-controlled trigger rules. launches
returns a launch decision object: webview, external_browser, or
not_eligible.
Package boundary
Install@userjourneys/interviews-react-native in your app. The SDK includes
the shared UserJourneys interview runtime in its published JavaScript and type
output, so there is no separate UserJourneys core package for app teams to
install or version.