shy-kilobyte-27547
11/20/2023, 4:06 AMString userId = AuthService.firebase().currentUser!.id;
String userEmail = AuthService.firebase().currentUser!.email ??
""; // If email is null, use an empty string
// Creating a RudderTraits object and set the user's email
RudderTraits userTraits = RudderTraits();
userTraits.putEmail(userEmail);
// We can add more attributes like userTraits.putName later;
// Identifying the user with RudderStack using their email and attributes
userTraits.putEmail(userEmail);
RudderController.instance.identify(userId, traits: userTraits);
// Logging page view on Rudderstack
RudderProperty screenProperty = RudderProperty();
screenProperty.put("user_id", userId);
screenProperty.put("page_name", "Home page viewed");
RudderController.instance.screen("Home page viewed",
category: "user_views", properties: screenProperty);
• Then I also track the clicking of a button on the same screen and this action is getting always grouped under the user ID that is being merged from all users. (the code is part of the onTap function)
onTap: () {
// rudderstack Fetching user information
String userId =
AuthService.firebase().currentUser!.id;
String userEmail =
AuthService.firebase().currentUser!.email ??
"";
// Creating event properties for RudderStack
RudderProperty properties = RudderProperty();
properties.put("user_id", userId);
properties.put("user_email",
userEmail); // Adding user's email
properties.put("button",
"Reading Session From Home Page Clicked"); // Describing the button
properties.put(
"action", "Clicked"); // Action performed
// Tracking the button click event with RudderStack
RudderController.instance.track(
"Reading Session From Home Page Button Clicked",
properties: properties);
I am not sure what is going awry in the second example as compared to the first... Truly would love any pointers you have!millions-activity-52391
11/20/2023, 4:06 AMkind-carpenter-27609
11/20/2023, 4:11 AMreset() API, whenever a user logs out and calling Identify() API again with the new userId ?shy-kilobyte-27547
11/20/2023, 10:27 AMmillions-activity-52391
11/20/2023, 11:24 AMshy-kilobyte-27547
11/20/2023, 9:12 PMmillions-activity-52391
11/21/2023, 11:12 AMshy-kilobyte-27547
11/27/2023, 12:57 AMmillions-activity-52391
12/05/2023, 3:28 PMshy-kilobyte-27547
12/07/2023, 6:46 AMmillions-activity-52391
12/07/2023, 9:12 AM