Skip to main content
Digia as CEPChange your setup in the sidebar

Step 3: Report screens

Call setCurrentScreen on every screen visit so Digia Engage can show campaigns on specific screens of your React Native, Android, iOS and Flutter app.

Tell Digia which screen the user is on, every time they arrive on it (including coming back to it). Campaigns can then show on specific screens.

With React Navigation, useFocusEffect runs each time a screen comes into focus:

import { useFocusEffect } from '@react-navigation/native';
import { useCallback } from 'react';
import { Digia } from '@digia-engage/core';

export function useScreenTracking(screenName: string) {
useFocusEffect(
useCallback(() => {
Digia.setCurrentScreen(screenName);
}, [screenName]),
);
}

// In each screen:
useScreenTracking('product_detail');

Using Expo Router, react-native-navigation, or no navigation library? See Reporting the Current Screen.

Screen names are case-sensitive. product_detail and ProductDetail are different screens. Your campaign team doesn't type these names: when they capture screens from a debug build, the dashboard lists the names your app reports, and they pick from that list. So the names in your code are the names they see.