Tracking Events
Track user interactions by calling the track
method. Ensure the session is initialized before tracking events:
Nudge.getInstance().track(event: "event_name");
or
nudge.track(event: "event_name");
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.
warning
- Do not use
Nudge.getInstance().track()
ornudge.track()
insidebuild
method of a stateful widget.
Send Event Properties
Just like you added user properties, you can also send event properties along with you event:
Map<String,dynamic>? props = {
"tier" : "Gold",
"location" : "India",
"subscribe" : "No"
};
nudge.track(event: "event_name",properties: props);
or
Map<String,dynamic>? props = {
"tier" : "Gold",
"location" : "India",
"subscribe" : "No"
};
Nudge.getInstance().track(event: "event_name",properties: props);