Paywall Preloading and Caching
Make Superwall paywalls open instantly. Learn how the SDK preloads paywalls at launch, how to prioritize or preload specific placements, and how Cache on Device keeps paywalls on the device.
A paywall that has to load when the user taps a button shows a loading state first. Superwall avoids that in two ways: the SDK preloads paywalls in the background when your app launches, and it caches them, so a paywall that loaded once opens again without waiting on the network.
How preloading works
Preloading is on by default. When your app launches from a cold start, the SDK fetches your configuration, works out which paywalls the user could see from your campaigns' placements and audiences, and loads those paywalls in the background. Paywalls in audiences the user can't match aren't loaded.
After a paywall loads, the SDK keeps it, and doesn't load it from the network again until you change it on the dashboard.
Load an important paywall first
If one paywall must be ready right away, such as an onboarding or first-launch paywall, prioritize its campaign with Priority Placements. The SDK loads that campaign's paywalls before the rest.
On Android, use SDK 2.8.7 or later for prioritized preloading. Earlier versions load every assigned paywall in the first batch, alongside the prioritized campaign.
Control preloading from your app
If your app has many paywalls, preloading all of them can use more network on first launch. You can turn automatic preloading off, then preload only the placements you need:
let options = SuperwallOptions()
options.paywalls.shouldPreload = false
Superwall.configure(apiKey: "MY_API_KEY", options: options)
// Later, preload the paywalls for specific placements
Superwall.shared.preloadPaywalls(forPlacements: ["onboarding_complete"])
// Or preload every paywall
Superwall.shared.preloadAllPaywalls()val options = SuperwallOptions()
options.paywalls.shouldPreload = false
Superwall.configure(this, apiKey = "MY_API_KEY", options = options)
// Later, preload the paywalls for specific placements
Superwall.instance.preloadPaywalls(setOf("onboarding_complete"))
// Or preload every paywall
Superwall.instance.preloadAllPaywalls()final options = SuperwallOptions();
options.paywalls.shouldPreload = false;
Superwall.configure("MY_API_KEY", options: options);
// Later, preload the paywalls for specific placements
Superwall.shared.preloadPaywallsForPlacements({"onboarding_complete"});
// Or preload every paywall
Superwall.shared.preloadAllPaywalls();const { preloadPaywalls, preloadAllPaywalls } = useSuperwall();
// Preload the paywalls for specific placements
await preloadPaywalls(["onboarding_complete"]);
// Or preload every paywall
await preloadAllPaywalls();These methods don't reload paywalls that are already preloaded. For each SDK's options, see SuperwallOptions.
Cache on Device
Each paywall also has a Cache on Device setting. In the paywall editor, click Settings in the sidebar and turn on Cache on Device.
With it on, the SDK loads the paywall's web content from the device's cache when it's there, and from the network only when it isn't. This helps most with paywalls that have large assets, such as a video, that would otherwise take a few seconds to fetch. It works on iOS and Android, including apps built with Flutter and Expo.
How long changes take to reach devices
- Superwall's CDN caches your configuration for up to 1 hour. After you publish a change, new users get it right away, and existing users can see the old version for up to an hour.
- Reinstalling the app clears the paywalls cached on the device.
Superwall.reset()clears the user's data on the device, but not their assignments on Superwall's servers.
If a paywall still looks old after an hour, see Why is my paywall not updating after publishing?
Slow or missing network
If the network is slow or unavailable, preloading can't finish, and the SDK retries. See Handling connectivity interruptions.
Related
- Priority Placements
- Paywall settings
- Local Resources, to bundle images and videos with your app so the paywall doesn't download them
How is this guide?
Paywall Presentation Styles
Show a Superwall paywall full screen, as a modal, a bottom drawer, a centered popup, or pushed onto your navigation stack. Pick the style per paywall in the editor, with no app update.
Free Trials and Introductory Offers on Paywalls
Show free trials and introductory offers on Superwall paywalls: check trial eligibility with products.hasIntroductoryOffer, write trial copy with product variables, override eligibility, remind users before a trial ends, and target users who cancelled.