iOS User Behaviour

Reteno SDK provides powerful tools to track user behavior in iOS applications. This includes logging screen views, custom events, and monitoring push notification subscription status. Events can be tracked either manually or automatically, depending on the level of control developers require.
Below is a breakdown of events that can be tracked using Reteno SDK, divided into two categories: Custom Events and Automatically Tracked Events.

📘

Note

Tracking custom events must be configured manually. Ensure that all necessary events are properly set up to collect the required data.

Custom Events

The ability to track custom events is necessary for effective data analysis and user engagement strategies. Custom event tracking allows you to monitor specific user actions beyond standard metrics, offering tailored insights into how users interact with your app. This flexibility helps you align your data collection with business goals, measure the success of key features, and identify opportunities for improvement.

By tracking custom events, you gain a deeper understanding of user behavior, enabling data-driven decisions to enhance the app experience. For instance, you can analyze patterns like feature usage, conversion rates, or drop-off points in the user journey. These insights empower you to optimize workflows, personalize experiences, and ultimately increase user satisfaction and retention. Custom event tracking ensures your analytics adapt to the unique needs of your app, providing actionable insights that drive growth.

📘

Note

Correct planning and naming of custom events in mobile apps are essential for collecting meaningful data and making informed decisions.

For detailed guidance, check out these resources:

Custom events are tracked as follows:

// Parameters:

public struct Parameter {
    let name: String
    let value: String?
}

date: Date - time when event occurred

forcePush: Bool - indicates if event should be send immediately or in the next scheduled batch

// Usage

Reteno.logEvent(eventTypeKey: "EVENT_TYPE_KEY", date: Date, parameters: [Reteno.Event.Parameter], forcePush: Bool = false)

📘

Note

Set up event-based segmentation to ensure custom events and their parameters are recorded in contact cards, enabling the creation of dynamic segments.

Automatically Tracked Events

Automatically tracked events include

  • Screen View Events
  • Mobile Push Subscribes
  • Session Events

Screen View Events

Reteno tracks screen appearance and attaches information about the current screen to events. You can also manually log screenviews. Manually tracking screens is useful if your app does not use a separate UIViewController for each screen you may wish to track.

Automatically Track Screen Events

Reteno automatically tracks some information about screens in your application, such as the class name of the UIViewController that is currently in focus. When a screen transition occurs, Reteno logs a screen view event that identifies the new screen.

Automatic screen tracking can be turned off by providing isAutomaticScreenReportingEnabled flag as false during SDK initialization.

📘

Note

Reteno depends on method swizzling to automatically log screen views. SwiftUI apps must manually set class for views that should be logged, or log screen views manually (see below).

Manually Track Screen Events

You can manually log screen view events whether or not automatic tracking is enabled. You can log these events in the onAppear or viewDidAppear methods.

Reteno.logEvent(ScreenViewEvent, parameters: [ScreenClass: screenClass])

Mobile Push Subscribes

Reteno SDK uses the pushSubscribed parameter for tracking the status of the user’s subscription to push notifications. This covers the following cases:

  • When a customer does not subscribe to receive push notifications (pushSubscribed is false), no token is created for that customer.
  • When a customer subscribes to receive push notifications (pushSubscribed is true), a token is created for that customer.
  • When a customer unsubscribes from receiving push notifications (pushSubscribed is false), the existing customer token is deleted.

Starting from version 2.0.4 Reteno can track push notification subscription events. This event will be tracked automatically but it can be managed.

let configuration: RetenoConfiguration = .init(isAutomaticPushSubsriptionReportingEnabled: true)
Reteno.start(apiKey: "API_KEY", configuration: configuration)

When isAutomaticPushSubsriptionReportingEnabled is enabled Reteno tracks the following events:

Event NameDescription
PushNotificationsSubscribedThis event fires when a customer susbribes for push notifications
PushNotificationsUnsubscribedThis event fires when a customer unsubscribes from push notifications

Session Events

Starting from version 2.0.4 Reteno can track start session and end session events. This event will be tracked automatically but it can be managed.

let configuration: RetenoConfiguration = .init(isAutomaticSessionReportingEnabled: true)
Reteno.start(apiKey: "API_KEY", configuration: configuration)

When isAutomaticSessionReportingEnabled is enabled Reteno tracks the following events:

Event NamePropertiesDescription
SessionStartedsessionId, startTimeThis event fires when a user's session started
SessionEndedsessionID, endTime, durationInSeconds, applicationOpenedCount, applicationBackgroundedCountThis event fires when a user's session ended

📘

Note

Tracking e-commerce events is described in a separate article.