React Native User Behaviour

Track Custom Events

Reteno SDK provides ability to track custom events.

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

date

Date should be in ISO8601 format

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

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>;

Log 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.