Skip to main content
PaywallInfo contains comprehensive information about a paywall, including its configuration, associated experiment, products, loading times, and other metadata. This object is central to understanding paywall behavior and is provided in many SDK callbacks and events.

Definition

interface PaywallInfo {
  identifier: string
  name: string
  url: string
  experiment?: Experiment
  products: Product[]
  productIds: string[]
  presentedByEventWithName?: string
  presentedByEventWithId?: string
  presentedByEventAt?: number
  presentedBy: string
  presentationSourceType?: string
  responseLoadStartTime?: number
  responseLoadCompleteTime?: number
  responseLoadFailTime?: number
  responseLoadDuration?: number
  isFreeTrialAvailable: boolean
  featureGatingBehavior: FeatureGatingBehavior
  closeReason: PaywallCloseReason
  webViewLoadStartTime?: number
  webViewLoadCompleteTime?: number
  webViewLoadFailTime?: number
  webViewLoadDuration?: number
  productsLoadStartTime?: number
  productsLoadCompleteTime?: number
  productsLoadFailTime?: number
  productsLoadDuration?: number
  paywalljsVersion?: string
  computedPropertyRequests: ComputedPropertyRequest[]
  surveys: Survey[]
  localNotifications: LocalNotification[]
  state: Record<string, any>
}

Properties

identifier
string
required
The unique identifier of the paywall, as configured in the Superwall dashboard.
name
string
required
The name of the paywall, as configured in the Superwall dashboard.
url
string
required
The URL where the paywall’s web content is hosted.
experiment
Experiment
The experiment associated with this paywall presentation, if applicable. Contains information about A/B tests and variants.
products
Product[]
required
A list of products available for purchase on this paywall.
productIds
string[]
required
A list of product identifiers (SKUs) available on this paywall.
presentedByEventWithName
string
The name of the event or placement that triggered the presentation of this paywall.Corresponds to presentedByPlacementWithName in the native Swift SDK.
presentedByEventWithId
string
The identifier of the event or placement that triggered the presentation of this paywall.Corresponds to presentedByPlacementWithId in the native Swift SDK.
presentedByEventAt
number
The Unix timestamp (in seconds or milliseconds) of when the event triggering this paywall occurred.Corresponds to presentedByPlacementAt in the native Swift SDK.
presentedBy
string
required
The source that initiated the paywall presentation.Possible values: "implicit", "explicit", "getPaywall"
presentationSourceType
string
The type of the source that led to the paywall presentation.Examples: "Register" for Superwall.shared.register(event:), "Track" for Superwall.shared.track(event:)
responseLoadStartTime
number
The Unix timestamp when the request to load the paywall configuration and rules (response) started.
responseLoadCompleteTime
number
The Unix timestamp when the paywall response successfully loaded.
responseLoadFailTime
number
The Unix timestamp if the paywall response failed to load.
responseLoadDuration
number
The duration (typically in milliseconds) it took to load the paywall response.
isFreeTrialAvailable
boolean
required
Indicates whether a free trial is available for any of the products on this paywall.
featureGatingBehavior
FeatureGatingBehavior
required
The feature gating behavior for this paywall.
  • "gated" - The feature or content is gated and requires a specific condition to be met for access
  • "nonGated" - The feature or content is available to all users
closeReason
PaywallCloseReason
required
The reason why the paywall was closed.
  • "systemLogic" - Closed automatically by the SDK due to internal logic
  • "forNextPaywall" - Closed because another paywall is scheduled to be presented
  • "webViewFailedToLoad" - Closed because the web view failed to load
  • "manualClose" - Closed due to direct user action
  • "none" - No specific reason or unknown
webViewLoadStartTime
number
The Unix timestamp when the web view started loading the paywall’s HTML content.
webViewLoadCompleteTime
number
The Unix timestamp when the web view successfully loaded the paywall’s HTML content.
webViewLoadFailTime
number
The Unix timestamp if the web view failed to load the paywall’s HTML content.
webViewLoadDuration
number
The duration (typically in milliseconds) it took for the web view to load the paywall’s content.
productsLoadStartTime
number
The Unix timestamp when the loading of product information (from App Store/Google Play) started.
productsLoadCompleteTime
number
The Unix timestamp when the product information successfully loaded.
productsLoadFailTime
number
The Unix timestamp if loading product information failed.
productsLoadDuration
number
The duration (typically in milliseconds) it took to load the product information.
paywalljsVersion
string
The version of the paywall.js script used in the paywall, if available.
computedPropertyRequests
ComputedPropertyRequest[]
required
A list of computed property requests associated with this paywall presentation.Computed properties are dynamic values based on user attributes or other data.
surveys
Survey[]
required
A list of surveys associated with this paywall that may be presented.
localNotifications
LocalNotification[]
required
A list of local notifications that may be scheduled as a result of this paywall presentation.
state
Record<string, any>
required
The state of the paywall, updated on paywall dismiss.Contains key-value pairs representing the paywall’s current state.

Usage

PaywallInfo is provided in many SDK callbacks and events:

With usePlacement Hook

import { usePlacement } from 'expo-superwall'

function MyComponent() {
  const { register } = usePlacement({
    placement: 'campaign_trigger',
    onPresent: (info) => {
      console.log('Paywall presented:', info.name)
      console.log('Products available:', info.productIds)
      console.log('Free trial available:', info.isFreeTrialAvailable)
      
      if (info.experiment) {
        console.log('Experiment ID:', info.experiment.id)
        console.log('Variant type:', info.experiment.variant.type)
      }
    },
    onDismiss: (info, result) => {
      console.log('Paywall closed:', info.closeReason)
      console.log('Result:', result.type)
    }
  })
  
  return <Button onPress={() => register()} title="Show Paywall" />
}

With Event Listeners

import { useSuperwallEvents } from 'expo-superwall'

function MyComponent() {
  useSuperwallEvents({
    onEvent: (event) => {
      if (event.event === 'paywallOpen') {
        const info = event.paywallInfo
        console.log('Paywall opened:', info.identifier)
        console.log('Load time:', info.webViewLoadDuration)
      }
    }
  })
}

Analyzing Performance

function analyzePaywallPerformance(info: PaywallInfo) {
  const metrics = {
    responseLoad: info.responseLoadDuration,
    webViewLoad: info.webViewLoadDuration,
    productsLoad: info.productsLoadDuration,
    totalLoadTime: 
      (info.responseLoadDuration || 0) + 
      (info.webViewLoadDuration || 0) + 
      (info.productsLoadDuration || 0)
  }
  
  console.log('Performance metrics:', metrics)
  
  if (metrics.totalLoadTime > 3000) {
    console.warn('Slow paywall load detected')
  }
}

Build docs developers (and LLMs) love