React Native User Behaviour

Reteno SDK provides powerful tools to track user behavior in 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:

import { logEvent } from "reteno-react-native-sdk";

const eventName = "EVENT_NAME";
const date = new Date().toISOString();
const parameters = [
  {
    name: "Additional parameter",
    value: "Additional value",
  },
];
const forcePush = false;

logEvent(eventName, date, parameters, forcePush);

The parameters list item structure:

type CustomEventParameter = {
  name: string;
  value?: string;
};

📘

Note

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

📘

Note

date

Date should be in ISO8601 format

forcePush is iOS-only feature; Please read more about it here

Automatically Tracked Events

Automatically tracked events include

  • Screen View Events
  • Mobile Push Subscribes
  • Session Events

Screen View Events

You can send screen view events using logScreenView function:

function logScreenView(screenName: string): Promise<void>;

There are a few ways to implement the navigation within React Native apps, therefore there is no "one fits all" , this function provides a basic mechanism for sending screen view events, and you can use it whatever way you want.

const someRouteName = getSomeRouteName();
await logScreenView(someRouteName);

You can check an example provided by React Navigation library, which can give you an idea of the implementation. See Screen tracking for analytics documentation.

Mobile Push Subscribes

iOS usage

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 a new customer.
  • When a customer unsubscribes from receiving push notifications (pushSubscribed is false), the existing customer token is deleted.
    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 subscribes for push notifications
PushNotificationsUnsubscribedThis event fires when a customer unsubscribes from push notifications

Android usage

Your end-user may prohibit receiving pushes by disabling Reteno notification channel or disabling notifications for your application in Android OS settings menu. In this case SDK will notify its servers to prevent sending push notifications to this specific device.
SDK checks notifications enabled status in these cases:

  • On App resume
  • On push received event
  • On settings changed in Android OS Settings menu (starting from Android 9.0, using system broadcast)
    Once status false sent to the server, the backend won't send any push notifications to this device until the end-user re-enables channel/notifications. Once the end-user re-enables channel/notifications the server will be notified and will send push notifications again.

Session Events

iOS usage

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

Force Push Data

Reteno SDK caches all events (events, device data, user information, user behavior, screen tracking, push statuses, etc) locally into database. Call forcePushData function to send all accumulated events:

function forcePushData(): Promise<void>;