Skip to main content

Targeting By Placement

Use Targeting by Placement to define paywall locations in your app so that you can serve unique Offerings at each paywall location to each customer.

📘SDK Compatibility

Targeting by Placement is available on iOS 4.38.1 and up, and Android 7.7.0 and up, with support for additional SDKs coming very soon.

Targeting by Placement Illustration

Supported in the following SDK versions:

RevenueCat SDKVersion required for Paywalls
purchases-ios4.38.0 and up
purchases-android7.7.0 and up
react-native-purchases7.23.0 and up
purchases-flutter6.22.0 and up
purchases-capacitor7.5.0 and up
purchases-unity6.9.0 and up

Defining Placements

To start, you'll need to define a few Placements for your app. To do that, consider the different contexts in your app where you may want to display a paywall, such as:

  • At the end of onboarding (e.g. onboarding_end)
  • When a customer attempts to use a paywalled feature (e.g. feature_gate)
  • When a sale is running (e.g. sale_offer)
📘Do I need a placement for ___?

When deciding which Placements to create, consider how your paywall(s) will compliment your ideal customer journey. For example, when you run a sale, do you want to show a different pitch & offer to onboarded customers vs. those using your app for the first time? If so, define a sale_offer Placement. If not, then skip it.

You can always create additional Placements in future releases of your app.

When your app fetches Offerings by Placement, we'll return the Offering to be displayed for that customer at that Placement, letting you display unique paywalls based on the customer journey.

Creating Targeting Rules for Placements

To define which Offerings should be served for an audience at each Placement, click + Add Placement when creating a new rule or editing an existing one.

Add Placement

📘Targeting "Any audience"

If you want to use Placements to serve unique Offerings at different paywall locations for all customers, you can do so by creating a Targeting Rule that targets "Any audience" as its condition. Then, order that rule at the bottom of your list of Live rules if you want other audience-specific Targeting Rules to supercede it.

Then, select the Offering you want to display, and enter the identifier of the Placement you want to serve that Offering on. If this is your first time using that Placement, you'll need to click Add to add its identifer to your list. Once you've saved this rule, that Placement will be available to select in other Targeting Rules.

Create a Placement

⚠️Placement Identifiers

Double check that the Placement strings you've defined in your app and through your Targeting Rules exactly match so that your Targeting Rules are applied correctly.

When using Placements, you'll always need to select an Offering to serve "for all other cases". This Offering will be served:

  • For any Placements other than the one(s) specified in this rule
  • For any new Placements added in the future
  • Or when getting the 'current' offering in any SDK version (e.g. the getOfferings() method), such as in older versions of your app, or areas of your app that are not fetching Offerings by Placement

Set a Placement for all other cases

Serving no Offering at a given Placement

You can also choose to serve No Offering at a given Placement, such as when the paywalled feature is not yet available in some region, or when the targeted audience is not eligible to receive a given offer.

Simply select No Offering for a given Placement in order to have a null value returned when your app requests Offerings for that Placement for customers matching that Targeting Rule.

⚠️Handling a nil Offering identifier

Be sure that your app is setup to expect and handle a nil value being returned when using the getCurrentOffering(forPlacement: "string") method if you expect to use Targeting in this way.

If you've chosen to serve No Offering "for all other cases" in a Targeting Rule, then you'll also need to specify an Offering to serve "when not using Placements", so that any calls to getOfferings in your current app or prior app versions still have some Offering identifer returned in case they're not designed to handle a null value.

Fetching Offerings by Placement

To use Placements in your app, after you have defined them in the Dashboard, you can use the getCurrentOffering(forPlacement: "placementIdentifier") method to fetch the Offering for a given Placement, where placementIdentifier must exactly match the value set in the Dashboard.

The method will return the Offering for that customer at that Placement.

let placementOffering = offerings.getCurrentOffering(forPlacement: "onboarding_end")

onboarding_end Placement

The Offering returned will correspond to one of these three cases:

The Offering identifier (or nil value) specified for that customer at that Placement

This will occur if the customer matches a Targeting Rule, and the Placement is specified in that Targeting Rule.

The Offering identifier (or nil value) specified for that customer "in all other cases"

This will occur if the customer matches a Targeting Rule, and the Placement is not specified in that Targeting Rule.

The Offering identifier specified as the Default Offering for your Project when no Targeting Rules apply

This will occur if the customer does not match a Targeting Rule.

Purchases.shared.getOfferings { offerings, error in
if let offering = offerings?.currentOffering(forPlacement: "your-placement-identifier") {
// TODO: Show paywall
} else {
// TODO: Do nothing or continue on to next view
}
}
📘Migrating Offerings calls to the new method

getCurrentOffering(forPlacement: "string") should replace any getOfferings() calls in your app that you want to control independently through Placements.

FAQs

Can I run an Experiment to test different Offerings to serve at a given Placement?

Not yet, but support for Placements in Experiments will be coming soon.

Can I still use the existing method to fetch Offerings in some places in my app?

Absolutely. The existing method will continue to work as it does today, and will return the Offering "for all other cases" if you're using Placements in a Targeting Rule.

Can I delete a Placement identifier once I've created it?

The list of available Placement identifiers to select from is sourced from your existing Targeting Rules, so if you delete all Targeting Rules referencing that Placement, it will no longer be listed in the Dashboard. However, keep in mind that any prior app versions fetching Offerings for that Placement will continue to do so, and the Offering set "for all other cases" will be served in its place.