Hi there, I am a total beginner at this and strugg...
# support
s
Hi there, I am a total beginner at this and struggling with some issues to do with user ID. Would be massively grateful for any advice you have. 🙂 The set up - I am working on a flutter app and use Rudderstack to collect data, which I then send to Amplitude. The problem: The issue I face is that nearly all actions on the app get grouped under one user id, so I have to manually look through the user attributes to see which email is doing what. (for context we are just in the internal testing stage, which is why it's important for us to know which person is doing what). I see in the live stream on rudderstack that my events are getting tracked but in the payload I see this one user ID that just keeps appearing no matter what email the user is signed in under. I don't know how to disentangle this... The user ID works in some cases correctly, in some not. For example in my home page I do the following - • Where the ID works is for example to track the page view - I have the below (note that only logged in users can access this part of the app) /`/ Fetching ID and email of the logged-in user`
String 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!
m
Hey There! đź‘‹ Your message has been received by the RudderStack team. Our standard customer support hours are 9-6 PM EST, but we will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
k
Were you calling the
reset()
API, whenever a user logs out and calling
Identify()
API again with the new userId ?
🙏 1
👍 1
🎉 1
s
Hmm nope, come to think of it I do not have a reset() anywhere in my instrumentation. Thanks for that tip^ I will investigate how to include that 🙂 .
m
Hi Anna, I assume you are testing from a single device and hence the userIds remain the same (Even though the logged in email changes). This should not be a problem in the real world since different users their own devices and most devices don't have multiple users (though a user may have multiple devices)
🙏 1
s
Hi @shy-kite-21035 thanks so much for your message. I am actually testing across quite a lot of devices via TestFlight and so on - so we have about 30 testers each with a different phone, and the issue is that they are all merging into this one. When I write code though, that is true I do sometimes use the same device for a few accounts to test things + use emulators and simulators too.
m
Hi Anna, can you share the sample payload from different users (different users). I am curious if they have the same AnonymousId. Also can you provide the following details. - iOS SDK version - RudderStack iOS SDK version - Sample payloads from different users Since you are using TestFlight I have requested only iOS data. Do remove any PII before sharing the data.
🙏 1
🎉 1
👍 1
s
Thanks @shy-kite-21035 and apologies for the slow reply. Thanks so much for your help 🙂 I am very confused by this... Rudder SDK: 2.6.0 iOS SDK: 17.0 Payloads: I am sending info from 2 users, the home page view works fine and the press pause button worked ok for user 2 but not the user 1. User 1 - pressed pause button - not working correctly - get the user ID 2VQdfJJEKu4lYprW6LbNHqxCLsQ which is the one where lots of stuff is merging into { "anonymousId": "d96021c1-6868-4c44-b0b8-abe3475bf0ee", "channel": "mobile", "context": { "app": { "build": "19", "name": "strive", "namespace": "com.alto-education.strive", "version": "1.0.0" }, "device": { "attTrackingStatus": 0, "id": "5050a7c5-df11-4722-9f17-b034bdbf07c6", "manufacturer": "Apple", "model": "iPhone", "name": "iPhone", "type": "iOS" }, "library": { "name": "rudder-ios-library", "version": "1.23.0" }, "locale": "en-CN", "network": { "cellular": false, "wifi": true }, "os": { "name": "iOS", "version": "16.6" }, "screen": { "density": 3, "height": 844, "width": 390 }, "sessionId": 1701045891, "timezone": "Australia/Melbourne", "traits": { "date": 1701045892935, "email": "REDACTED”, "userId": "2VQdfJJEKu4lYprW6LbNHqxCLsQ" } }, "event": "Pressed the pause button on reading timer", "integrations": { "All": true }, "messageId": "90d6c194-900d-4f71-ba1e-b4e60533404b", "originalTimestamp": "2023-11-27T004501.806Z", "properties": { "page": "Pressed the pause button on reading timer", "user_id": "aUMSZ29JvtcgP5nj9d604WB5bxM2" }, "rudderId": "18941ba4-bc8e-41d0-aaf2-7d262a25bb23", "sentAt": "2023-11-27T004503.740Z", "type": "track", "userId": "2VQdfJJEKu4lYprW6LbNHqxCLsQ" } User 1 - working fine with IDs when viewing home screen { "anonymousId": "d96021c1-6868-4c44-b0b8-abe3475bf0ee", "channel": "mobile", "context": { "app": { "build": "19", "name": "strive", "namespace": "com.alto-education.strive", "version": "1.0.0" }, "device": { "attTrackingStatus": 0, "id": "5050a7c5-df11-4722-9f17-b034bdbf07c6", "manufacturer": "Apple", "model": "iPhone", "name": "iPhone", "type": "iOS" }, "library": { "name": "rudder-ios-library", "version": "1.23.0" }, "locale": "en-CN", "network": { "cellular": false, "wifi": true }, "os": { "name": "iOS", "version": "16.6" }, "screen": { "density": 3, "height": 844, "width": 390 }, "sessionId": 1701045891, "timezone": "Australia/Melbourne", "traits": { "email": “REDACTED”, "userId": "aUMSZ29JvtcgP5nj9d604WB5bxM2" } }, "event": "Home page viewed", "integrations": { "All": true }, "messageId": "b82326c7-5fee-47aa-998e-a7dc3f7b1a7c", "originalTimestamp": "2023-11-27T004452.944Z", "properties": { "category": "user_views", "name": "Home page viewed", "page_name": "Home page viewed", "user_id": "aUMSZ29JvtcgP5nj9d604WB5bxM2" }, "rudderId": "33c1f3f7-6eb0-4b92-81e5-285b4f7f8156", "sentAt": "2023-11-27T004503.740Z", "type": "screen", "userId": "aUMSZ29JvtcgP5nj9d604WB5bxM2" } User 2 - working on home page view { "anonymousId": "9e345d7e-6ae0-4aaf-9d2d-a02a2a0ea542", "channel": "mobile", "context": { "app": { "build": "23", "name": "strive", "namespace": "com.alto-education.strive", "version": "1.0.0" }, "device": { "attTrackingStatus": 0, "id": "0d4a5ea5-c98d-4975-8ad9-00886b2be16f", "manufacturer": "Apple", "model": "iPhone", "name": "iPhone", "type": "iOS" }, "library": { "name": "rudder-ios-library", "version": "1.23.0" }, "locale": "en-CZ", "network": { "cellular": false, "wifi": true }, "os": { "name": "iOS", "version": "16.6.1" }, "screen": { "density": 2, "height": 896, "width": 414 }, "sessionId": 1701045826, "timezone": "Australia/Melbourne", "traits": { "email": "REDACTED”, "userId": "C8HXhLG2tGNTsrAhPqxzF3gUSov2" } }, "event": "Home page viewed", "integrations": { "All": true }, "messageId": "d1c800b7-b117-41d0-9f00-3d56600fe32d", "originalTimestamp": "2023-11-27T004903.951Z", "properties": { "category": "user_views", "name": "Home page viewed", "page_name": "Home page viewed", "user_id": "C8HXhLG2tGNTsrAhPqxzF3gUSov2" }, "rudderId": "02371db2-0980-401e-a7e2-bf132ca4a4a9", "sentAt": "2023-11-27T004905.360Z", "type": "screen", "userId": "C8HXhLG2tGNTsrAhPqxzF3gUSov2" } User 2: Pressed pause button - working { "anonymousId": "9e345d7e-6ae0-4aaf-9d2d-a02a2a0ea542", "channel": "mobile", "context": { "app": { "build": "23", "name": "strive", "namespace": "com.alto-education.strive", "version": "1.0.0" }, "device": { "attTrackingStatus": 0, "id": "0d4a5ea5-c98d-4975-8ad9-00886b2be16f", "manufacturer": "Apple", "model": "iPhone", "name": "iPhone", "type": "iOS" }, "library": { "name": "rudder-ios-library", "version": "1.23.0" }, "locale": "en-CZ", "network": { "cellular": false, "wifi": true }, "os": { "name": "iOS", "version": "16.6.1" }, "screen": { "density": 2, "height": 896, "width": 414 }, "sessionId": 1701045826, "timezone": "Australia/Melbourne", "traits": { "email": "REDACTED”, "userId": "C8HXhLG2tGNTsrAhPqxzF3gUSov2" } }, "event": "Pressed the pause button on reading timer", "integrations": { "All": true }, "messageId": "a6431366-c73a-4526-a225-3b2f202cd184", "originalTimestamp": "2023-11-27T005012.945Z", "properties": { "page": "Pressed the pause button on reading timer", "user_id": "C8HXhLG2tGNTsrAhPqxzF3gUSov2" }, "rudderId": "02371db2-0980-401e-a7e2-bf132ca4a4a9", "sentAt": "2023-11-27T005015.289Z", "type": "track", "userId": "C8HXhLG2tGNTsrAhPqxzF3gUSov2" }
m
Hi Anna, can we setup a call for this? You can setup a call here
âś… 1
s
Thanks so much @shy-kite-21035, just booked in for next week. Really appreciate the help 🙏
m
Noted