Timing Your Purchasely Paywalls with ContextSDK: The Missing “When” in Paywall Targeting

Introduction
Demographics say who, behavior says what - but context decides when.
You can build the perfect Purchasely paywall, design the right plans and still lose conversions if you show it at the wrong moment. The same user can be “not now” while they’re in motion and “I’m ready” a few minutes later - without anything about the user changing.
This article shows how to add that missing “when” layer to Purchasely paywall targeting using ContextSDK’s on-device, real-world context signals.
This collaboration builds on earlier conversations between our teams, including a deep dive Felix Krause did with Purchasely on the Subscription League podcast, where timing, UX and sustainable monetization were already central themes. This integration turns those ideas into something teams can actually ship.
The two decisions every Purchasely paywall strategy needs
Paywall performance depends on two distinct decisions:
- Where to show the paywall (which flow, screen, or step)
- When to show it within a session (is this a good moment to ask?)
Most teams invest heavily in #1 and underestimate how much #2 changes outcomes.
- Where in Your App to Show the Paywall
You likely already know the high-intent moments in your product - the flows where it’s natural to show an upgrade prompt.
A classic “must show” moment: When a user tries to access a premium feature
In those cases, the full paywall experience is usually the right call.
The optional moments (where timing matters most): These are situations where you could ask for an upgrade, but you don’t want to ask every time:
- During or after onboarding
- After adding a new entry or saving work
- After reaching a usage milestone or limit
- After completing a positive action (finishing a level, sharing content, etc.)
Purchasely placements: your “where” layer
Purchasely models these opportunities as placements - specific locations in the user journey that can trigger different paywalls and rules.
A placement is defined in code and managed in the Purchasely Console.
The limits of built-in controls
Purchasely gives you powerful tools to shape exposure:
- Segmentation and audiences
- A/B testing paywalls and timing
- Frequency limits to reduce fatigue
These work well, but they mostly operate on who the user is and what they’ve done.
- When to show the paywall within the session
Now comes the tricky part.
With multiple placements and frequency limits, the first session often uses up all allowed prompts. Users dismiss while distracted, and later - in calmer, higher-intent moments - cooldown rules block the paywall.
Picture this:
A user installs your app during a rushed moment and dismisses two early prompts. Later that evening, they return in a longer, relaxed session - the moment they’d actually consider upgrading. But the paywall never appears.
Traditional targeting treats both sessions as equal. The user is the same. The placements are the same. But the moment is not.
That’s the missing layer: real-world context.
The third dimension: real-world context
By analyzing the phone's motion sensor data, ContextSDK can detect what a user is doing right now and whether they're receptive to in-app offers or messages. In other words, this technology identifies the perfect moment when a user is most likely to engage with an app-we call this Moment Monetization.
- No additional app permissions required
- Adds ~500kb to your app’s binary
- On-device processing for privacy and fast decisions
- Designed to help you show fewer prompts, but at better moments
The key output: shouldUpsell
ContextSDK produces a value called shouldUpsell, indicating whether the current moment is optimal for showing an offer.
You can apply this per placement:
- Be more aggressive during onboarding
- Be more selective during day-to-day usage
This lets you improve conversion without increasing interruptions.
Technical Integration
The integration is straightforward-here's how to combine ContextSDK with Purchasely:
Step 1: Set Up ContextSDK
First, integrate ContextSDK into your app. Add it to your project using CocoaPods, Swift Package Manager, or manually:
Then initialize it in your AppDelegate:
Step 2: Capture Context Before Showing Paywalls
The key is to capture the user's context before you show the paywall. Here's a complete example:
Understanding the Flow
Let's break down what's happening:
ContextManager.instantContext(flowName:duration:)- This captures the user's real-world context. The flow name (e.g., "purchasely_onboarding") uniquely identifies this opportunity in your app. Use descriptive names like "purchasely_settings", "purchasely_post_action", etc.Purchasely.setUserAttribute()- This passes theshouldUpsellvalue to Purchasely as a user attribute. You can then use this in the Purchasely Console to create audience rules-for example, only showing the paywall when context_should_upsell is true. This gives you flexibility to A/B test different strategies without code changes.Purchasely.presentationController(for:)- This is your standard Purchasely integration. The placement ID (e.g., "onboarding") should match what you've configured in your Purchasely dashboard.context.log()- This logs the outcome, which is crucial for training the ML model:.positive- User completed a purchase.negative- User dismissed the paywall.skipped- Paywall wasn't shown, or user restored purchases
Multiple Placements Example
You can use this pattern across multiple placements in your app:
Best Practices
Flow Naming Convention: Use a consistent naming pattern for your flow names. We recommend using snake_case and grouping related flows with the same prefix, e.g.:
purchasely_onboarding_step_1purchasely_onboarding_step_2purchasely_post_levelpurchasely_settings
Placement Mapping: Your ContextSDK flow names don't need to match your Purchasely placement IDs, but having a clear relationship helps maintain your code. For example:
- Flow name: "
purchasely_onboarding" → Placement: "onboarding" - Flow name: "
purchasely_settings" → Placement: "settings"
Always Log Outcomes: The ML model learns from the outcomes you log. Make sure to always log one of the three outcomes (.positive, .negative, or .skipped) for every context you capture.
How It Works: The Calibration Phase
When you first integrate ContextSDK:
- Calibration Phase: During this initial period,
context.shouldUpsellalways returnstrue(which gets passed to Purchasely ascontext_should_upsell=true), allowing you to collect data. You'll need approximately 1,000 positive outcomes (purchases) for the model to be trained. - Model Training: The ContextSDK team trains a custom ML model specifically for your app and your user base using the collected data.
- Model Deployment: Once trained, the model is automatically deployed to your app. From this point forward,
context.shouldUpsellwill make real-time decisions about whether it's a good moment, and this decision will be passed to Purchasely where you can use it in your audience rules. - Continuous Optimization: The model continues to learn and improve over time as more data is collected.
The Results: Better conversion with less interruption
When you combine:
- Where you show paywalls (Purchasely placements)
- When you show them (ContextSDK shouldUpsell)
…you can improve conversion rates without training users to dismiss prompts.
In practice, ContextSDK X Purchasely helps you:
- Increase conversion rates by showing paywalls at better moments
- Reduce interruptions during low-receptivity sessions
- Protect UX while still capturing intent
- Keep decisions privacy-first with on-device processing
→ If you're a visual learner, check out this Loom we've recorded which shows all of this in action.
Next Steps
Get Started with ContextSDK
ContextSDK is available for production use. To get started:
- Sign up at dashboard.contextsdk.com
- Create a license key for your app
- Integrate the SDK following the steps above
- Start logging conversions to begin the calibration phase
Get Started with Purchasely
If you're not already using Purchasely:
- Sign up at purchasely.com
- Set up your products and placements
- Integrate the Purchasely SDK into your app
- Configure your paywalls in the Purchasely Console
Case Study Collaboration
We're selecting partners to co-publish joint case studies showcasing results with ContextSDK × Purchasely. If you'd like to participate and share your success story, reach out to dieter@contextsdk.com and we'll guide you through the next steps.
Learn More
- ContextSDK Documentation: docs.contextsdk.com
- Purchasely Documentation: docs.purchasely.com
Contact ContextSDK: dieter@contextsdk.com




