NEW! 50% revenue boost for Blackbox - read the case study!
ContextSDK logo in purple
Products
ContextDecisionContextPush
Solutions
Solutions
Teams
DevelopersHeads of ProductMarketers
Industries
GamingEntertainmentHealthSocial MediaDating
Use cases
Dynamic Product ExperiencePush Notification Open Rate
Teams
DevelopersHeads of ProductMarketers
Industries
GamingEntertainmentHealthSocial MediaDating
Use Cases
Dynamic Product ExperiencePush Notification Open Rate
Resources
Resources
Value CalculatorCase Study CollectionNewsletterMonetization PlaybookBlogDemo AppDocs
Company
ContactCareersPressPrivacy & Security
LoginContact us
Blog
/
Engineering

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

Your Purchasely paywalls already know who to target and where to appear. But what if conversion depends on when you ask? By combining Purchasely placements with ContextSDK’s real-world, on-device context signals, you can surface subscription offers at moments of true receptivity - increasing upgrades while reducing unnecessary interruptions.
Felix Krause

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:

  1. Where to show the paywall (which flow, screen, or step)
  2. 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.

  1. 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.

  1. 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:

  1. 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.
  2. Purchasely.setUserAttribute() - This passes the shouldUpsell value 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.
  3. 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.
  4. 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_1
  • purchasely_onboarding_step_2
  • purchasely_post_level
  • purchasely_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:

  1. Calibration Phase: During this initial period, context.shouldUpsell always returns true (which gets passed to Purchasely as context_should_upsell = true), allowing you to collect data. You'll need approximately 1,000 positive outcomes (purchases) for the model to be trained.
  2. Model Training: The ContextSDK team trains a custom ML model specifically for your app and your user base using the collected data.
  3. Model Deployment: Once trained, the model is automatically deployed to your app. From this point forward, context.shouldUpsell will 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.
  4. 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:

  1. Sign up at dashboard.contextsdk.com
  2. Create a license key for your app
  3. Integrate the SDK following the steps above
  4. Start logging conversions to begin the calibration phase

Get Started with Purchasely

If you're not already using Purchasely:

  1. Sign up at purchasely.com
  2. Set up your products and placements
  3. Integrate the Purchasely SDK into your app
  4. 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

Engineering
Timing Your Purchasely Paywalls with ContextSDK: The Missing “When” in Paywall Targeting
Engineering
Show Paywalls at the Perfect Moment with ContextSDK and Superwall
November 14, 2025
Engineering
Region-Based Targeting 2.0: Engage Users by Understanding Their Real-World Context
May 27, 2025
Engineering
How to train your first machine learning model and run it inside your iOS app via CoreML
May 6, 2024
Engineering
Safely distribute new Machine Learning models to millions of iPhones over-the-air
May 22, 2024
Blog Home
AllProductGrowthMarketEngineering

Subscribe to our newsletter, Contextualize this!

Welcome aboard!

Get ready to explore how real-world context can transform apps. Stay tuned for our upcoming issues!
Oops! Something went wrong while submitting the form.
LoginContact us
Leveraging real‒world user context to supercharge engagement and revenue since 2023.
GDPR CompliantSOC II Type 2
Founded by Felix Krause and Dieter Rappold.
ContextDecisionContextPushSolutionsProductsDemo App
CompanyContactCareers
Privacy & SecurityPrivacy PolicyImprint
© ContextSDK Inc. 169 Madison Avenue, STE 2895 New York, NY 10016 United States
support@contextsdk.com