Tracking Events
Nudge provides a track method to track user interactions in your application. You can also send event properties with the track method.
Nudge.track("event_name", {
amount: 100, // Event Properties
mode: "upi",
});
Warning
Event name, event properties, and user properties all follow this regex:^[a-z][a-z0-9_]{2, 99}$
- Only small alphabets, numbers, and underscores (_) are allowed.
- Spaces are not allowed in event names.
- Name cannot start with a number; it needs to start with an alphabet.
- The name should be between 2 and 99 characters in length.
- If any capital letter is sent, it will be converted to lowercase.
Tracking events from Android side
For applications with a hybrid structure, where some features are implemented in native Android and others in React Native, you can track events directly from the Android side using the following snippet:
HashMap<String, Object> trackProperties = new HashMap<>();
trackProperties.put("level", 5);
trackProperties.put("score", 1000);
Nudgecorev2ReactNativeModule.NudgeReactNative.track(
"LevelComplete", // event name
trackProperties // event properties (nullable)
);