Use email as id for users and fix signup events not being reported (#1067)

This commit is contained in:
Shrikant Sharat Kandula 2020-10-07 21:06:58 +05:30
parent fcb6c4c43c
commit fa709a6cde

View File

@ -65,13 +65,13 @@ public class AnalyticsService {
return userMono
.map(user -> {
// In case the user is anonymous, return as is without raising the event.
if (user.isAnonymous()) {
// In case the user is anonymous, don't raise an event, unless it's a signup event.
if (user.isAnonymous() && !(object instanceof User && event == AnalyticsEvents.CREATE)) {
return object;
}
HashMap<String, String> analyticsProperties = new HashMap<>();
analyticsProperties.put("id", object.getId());
analyticsProperties.put("id", object instanceof User ? ((User) object).getUsername() : object.getId());
analyticsProperties.put("object", object.toString());
analytics.enqueue(