UI / SDK Events
This section provides an overlook on UI / SDK Events
What are UI / SDK Events?
UI / SDK Events are generated by the SDK. They are triggered when a user interacts with the app:
- when a paywall or screen is being displayed
- when a user interacts with a plan picker, a carousel, a button, a link on a screen managed by the Purchasely SDK
- when a user signs-in, signs-out or restores a subscription or a non-consumable
The full list of UI / SDK Events is available here
What are they used for?
UI / SDK Events are useful to:
- determine which Screens users are exposed to
- understand how they navigate throughout the app and the different touch-points and Placements
- understand how users interact with the Screens and Paywalls
They are sent to the Purchasely Platform to compute Paywall Conversion Rates.
How to leverage them by implementing an Event delegate inside the app?
UI / SDK Events are gathered by the Purchasely Platform but they cannot be routed from the Purchasely Console to the webhook or to 3rd party integrations.
If you wish to track these events in your own Analytics or in a 3rd party analytics tool, you need to set yourself an event delegate / event listener inside the app.
Listening to events
Purchasely.setEventDelegate(self)
Purchasely.eventListener = eventListener
// Nothing special to setup, just go to "Receiving events" below
// Nothing special to setup, just go to "Receiving events" below
// Nothing special to setup, just go to "Receiving events" below
//not available at the moment
This code must be inserted after starting the SDK.
Receiving events
You will receive the events like this :
func eventTriggered(_ event: PLYEvent, properties: [String : Any]?) {
switch event {
case .linkOpened:
print("Link opened")
default:
print("Ignored")
}
}
private val eventListener = object : io.purchasely.ext.EventListener {
override fun onEvent(event: PLYEvent) {
when (event) {
PLYEvent.LoginTapped -> Log.d("Purchasely", "Login tapped, we should open login page")
}
}
}
Purchasely.addEventListener((event) => {
console.log('Event Name ' + event.name);
console.log(event.properties);
console.log(event);
});
//When you do not want to listen to events anymore
Purchasely.removeEventListener();
Purchasely.listenToEvents((event) =>
print(event.name)
);
Purchasely.addEventsListener((event) => {
console.log("Event Name " + event.name);
console.log(event.properties);
console.log(event);
});
//not available at the moment
Once received, these events can be directly forwarded to your internal Analytics or 3rd-party Analytics SDK inside your app.
What data is associated with UI / SDK Events
UI / SDK Events consist of JSON payloads. They all share a common structure and have a comprehensive set of attributes
Updated 29 days ago