SSpinosis

What Your App Should Render When the Experiment Service Is Offline

·Implementation

When your experiment service is offline or unreachable, your app should render the control variant for new users and the last cached variant for returning users. This fallback strategy ensures the app remains fully functional regardless of experiment infrastructure availability while minimizing exposure to untested experiences.

The control variant represents your current production experience that you know works, making it the safest choice when you can't reach the experiment service to get a proper assignment. For users who have already been assigned a variant in a previous session, showing their cached assignment maintains consistency and prevents confusing experience changes mid-experiment.

Why experiment outages shouldn't break your app

Treating experiment services as critical dependencies creates unnecessary fragility. Your core app functionality—authentication, content display, purchase flows—should work perfectly even when external experiment infrastructure is down. Users don't care about your testing methodology; they care whether your app does what they opened it to do. Building graceful degradation into your experiment integration prevents A/B testing infrastructure from becoming a single point of failure.

Outages happen for countless reasons: DNS issues, expired certificates, cloud provider incidents, misconfigured deployments, or simple network connectivity problems on the user's device. If your app refuses to work or shows a blank screen when it can't reach the experiment service, you've turned a testing tool into a liability that damages user trust and tanks your app store ratings.

Default new users to the control variant

When a user opens your app for the first time and the experiment service is unreachable, assign them to the control variant locally. The control represents your current production experience that has already proven to work, making it the lowest-risk fallback. You're not exposing new users to untested treatments, and you're not blocking them from using the app while waiting for network requests to resolve.

Store this local fallback assignment just like you would a server-provided assignment. If the experiment service comes back online later in the session or on a subsequent launch, you can optionally request a proper assignment and handle any variant mismatch according to your transition strategy. But the initial fallback ensures the app is immediately usable regardless of network conditions.

Serve cached variants to returning users

Users who have previously received a variant assignment should continue seeing that same variant when the experiment service is offline. This maintains consistency in their experience and prevents confusion from bouncing between different onboarding flows or pricing presentations. Your app should have already persisted their variant assignment locally after their first successful request, so you simply read from that cache when the service is unavailable.

This approach works particularly well for experiments using sticky variant assignment, where users should see the same experience across all sessions anyway. The cached variant is exactly what they're supposed to see, so experiment service availability becomes irrelevant for the majority of your launches. Only first-time users during an outage get the fallback control experience instead of being properly randomized.

Implement health checks before critical flows

For experiments that affect purchase flows or other revenue-critical moments, consider adding lightweight health checks before users reach those points. If your experiment service has been offline throughout the session, you can attempt one final assignment request with a short timeout before displaying the paywall. This gives the service a chance to assign a proper variant if it has recovered, while still falling back to control if it remains unavailable.

Don't make these health checks blocking or obvious to users. They should happen in the background as the user navigates toward the purchase screen, with the results updating the interface only if a new variant arrives before the user reaches the critical moment. The app must work perfectly whether the health check succeeds or times out, treating the experiment assignment as progressive enhancement rather than a requirement.

Log offline assignments for accurate analysis

Track when users receive fallback assignments due to service unavailability so you can properly interpret your experiment results. These users weren't truly randomized and should potentially be excluded from statistical analysis or at least flagged as a distinct cohort. Without this logging, offline periods create silent bias in your data where more users than expected appear in the control group.

When implementing onboarding experiments through services like Spinosis or similar platforms, ensure your integration logs both successful API assignments and local fallback assignments. This visibility helps you understand what percentage of users experienced the experiment as designed versus what percentage got the offline fallback. That context is essential when the experiment service attributes RevenueCat purchases to variants, since offline-assigned users might have different conversion characteristics.

Questions

Should you retry experiment assignment requests when they fail?

Implement a single retry with exponential backoff for failed assignment requests, but don't retry indefinitely. One immediate retry catches transient network blips, but continued retries during a real outage waste battery and data while delaying the inevitable fallback. After one retry fails, proceed with the fallback variant and rely on background revalidation on the next launch to get a proper assignment if the service has recovered.

How long should you cache variant assignments locally?

Cache assignments indefinitely until the experiment service explicitly provides a new assignment or you end the experiment entirely. For sticky variant experiments, the cached value is the source of truth and should persist across app reinstalls if possible by backing up to cloud storage. This ensures users maintain consistent experiences even if they switch devices or reinstall the app.

What if the offline period affects experiment statistical validity?

Extended outages during experiment enrollment can create selection bias if certain user cohorts are more likely to open the app during that window. Monitor the timestamps of fallback assignments and consider excluding that time period from analysis or running the experiment longer to compensate. If a significant percentage of users received fallback assignments, that experiment may need to be rerun to get clean data.

Turn on auto-optimize for one test.

Create a project, install the SDK, connect RevenueCat. Traffic starts shifting on its own.

Related guides