Skip to content

Send Action (Event) Examples

ruofan edited this page Feb 19, 2024 · 29 revisions

Prerequisites

  • Import OmniSegment SDK in your React Native project.
  • Ensure that the OmniSegment is properly initialized and configured.

Complete Registration

Syntax and Usage

  • Tracking with Email:
import OmniSegment, {
  OSGEventBuilder,
  OSGRecommendRequest,
  OSGRecommendType,
  OSGProduct,
} from "bebit-tech-react-native-app-sdk";

const LoginScreen = ({ navigation }: any) => {
  const handleLogin = () => {
    
    OmniSegment.login("omnisegment20240101"); // OmniSegment.login should be called with the unique user identifier (uid) of the member

    OmniSegment.setFCMToken("Test FCM Token from RN");
    OmniSegment.setCurrentPage("Login");

    OmniSegment.setAppId("TestAppId");
    OmniSegment.setAppName("TestAppName");
    OmniSegment.setDeviceId("TestDeviceId"); // OmniSegment.setDeviceId should be called with the unique device identifier (cid)


    const event = OSGEventBuilder.completeRegistration({email: 'renee@bebit-tech.com'})
    event.location = 'app://Login'
    event.locationTitle = 'Login'
    OmniSegment.trackEvent(event);

    navigation.navigate("Tab", { screen: "Home" });
   };

 return (
   <View style={styles.container}>
      <TouchableOpacity style={styles.button} onPress={handleLogin}>
        <Text style={styles.buttonText}>Login</Text>
      </TouchableOpacity>
   </View>
    )
  };

Clone this wiki locally