Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions content/shared/showing-paywalls/feature-gating.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,43 @@ Analytics.shared.track(
```
:::

### Every `register` call is an analytics event

Registering a placement doesn't only decide whether to show a paywall — it also records an analytics event. Every `register` call is captured by Superwall, **uncapped and free**, so you can use the SDK you already have as a full-fledged analytics destination with no separate library to install.

You don't need a feature closure or a presentation handler to log an event. Call `register` with just a placement name (and, optionally, params) and Superwall records it — fire-and-forget:

:::ios
<CodeGroup>

```swift Swift
Superwall.shared.register(placement: "workout_complete", params: ["total_workouts": 17])
```
</CodeGroup>
:::
:::android
```kotlin Kotlin
Superwall.instance.register("workout_complete", params = mapOf("total_workouts" to 17))
```
:::
:::flutter
```dart Flutter
Superwall.shared.registerPlacement("workout_complete", params: {"total_workouts": 17});
```
:::
:::expo
```tsx React Native
Superwall.shared.register({
placement: "workout_complete",
params: new Map([["total_workouts", 17]]),
});
```
:::

The exact same call powers both behaviors — the only thing that changes is whether you pass a feature closure or handler. With a `feature:` block, `register` can gate a feature or present a paywall based on the user's entitlements. Without one, it's a pure analytics event with nothing to run afterward. That means anything you log today can become a paywall moment later, **without an app update**.

Because there's no per-event fee and no cap, you can pipe **every** analytics event you already fire into Superwall and then query it back with row-level-security-protected SQL through the [Query API](/dashboard/guides/query-clickhouse). That makes Superwall a viable, agent-first home for your product analytics alongside (or instead of) Mixpanel, Amplitude, and PostHog — on top of everything it already does for paywalls.

### Getting a presentation result

Use `getPresentationResult(forPlacement:params:)` when you need to ask the SDK what would happen when registering a placement — without actually showing a paywall. Superwall evaluates the placement and its audience filters then returns a `PresentationResult`. You can use this to adapt your app's behavior based on the outcome (such as showing a lock icon next to a pro feature if they aren't subscribed).
Expand Down
Loading