Listening SDK Events

Instructions for listening Deepwall SDK events

Deepwall SDK manages paywalls' UI display in your app, and it also manages purchases and restoration of purchases whenever users trigger the buy or restore actions on the displayed paywalls.

Deepwall posts various events for the paywall display, purchase, or restore operations for apps to observe and take necessary actions when needed.

Event Observation

For iOS apps, first implement the DeepWallNotifierDelegate protocol to your class. Then you can use observeEvents method for event observation.

For non-iOS apps you need to use the Deepwall EventBus model.

DeepWall.shared.observeEvents(for: self)

We recommend removing the observer while you are closing if you observe events on screens.

DeepWall.shared.removeObserver(for: self)

Events Triggered

Following events are triggered by Deepwall SDK :

Event Parameters

Following parameters are supported with iOS SDK 2.4.2+ and Android SDK 2.6.0+ :

testId: Current id of display or experiment returned as response (This id changes whenever display or experiment is updated)

relatedTestId: Original id of display or experiment returned as response (This id does not change for a display or experiment)

isDisplay: If value is TRUE then the responded paywall is from a display, otherwise from an experiment.

Android Event Usage Example

EventBus.subscribe(Consumer { 
when(it.type){
   DeepWallEvent.EXTRA_DATA.value -> { 
   Toast.makeText(this, it.data.toString(), Toast.LENGTH_SHORT).show() } 

DeepWallEvent.CLOSED.value ->  {
val data = it.data as PaywallClosedInfo
Toast.makeText(this@MainActivity, "PAYWALL_CLOSED : ${data.pageId}", Toast.LENGTH_LONG).show() }


DeepWallEvent.PAYWALL_PURCHASE_SUCCESS.value -> {
val subscriptionResponse = it.data as SubscriptionResponse
subscriptionResponse.result.subscriptionList.forEach { subItem->
   if(subItem.isActive == 1){
       //Do something
   }
       }
DeepWall.closePaywall()
}

DeepWallEvent.PAYWALL_OPENED.value -> { 
val data = it.data as PaywallOpenedInfo
Toast.makeText(this@MainActivity, "PAYWALL OPENED : ${key.pageId}", Toast.LENGTH_LONG).show() } 
}})

Event Handling

You can see the following guides to learn about more about using SDKs and event handling triggers.

For displaying paywalls and handling display events:

For making purchases and handling purchase events:

For restoring purchases and handling restore events:

For closing paywall and handling close event:

Last updated