User Identification
User identification connects anonymous sessions to known users, enabling you to track complete user journeys, analyze cohorts, and understand individual behavior patterns.
Why Identify Users?
Before a user logs in or signs up, ROAARRR tracks their behavior anonymously. Once you identify them, all their past and future events are connected to their user profile, giving you a complete picture of their journey.
Benefits of user identification:
- Track users across multiple sessions and devices
- Analyze individual user behavior and patterns
- Build user cohorts and segments
- Calculate user-level metrics like retention and LTV
- Connect pre-signup behavior to post-signup actions
Basic User Identification
Identify with User ID
Call identify() as soon as a user logs in or signs up. You must pass your unique UID. This can be whatever you want to identify the user, such as an email address, a username, or a uid.
// After user signs up or logs in
analytics.identify({
identification: 'your_user_id'
});Identify with User Properties
Include additional user attributes to enable segmentation and analysis:
analytics.identify({
identification: 'user-uuid-123',
name: 'Alex Johnson',
company: 'Startup Inc',
company_size: '5-10',
role: 'founder'
});When to Identify Users
On Signup
Identify users immediately after they create an account:
async function handleSignup(email, password) {
// Create user account
const user = await createAccount(email, password);
// Identify the user
analytics.identify({
identification: user.id,
email: user.email,
});
// Track signup event
analytics.funnel('signup_completed');
}On Login
Re-identify returning users when they log in:
async function handleLogin(email, password) {
// Authenticate user
const user = await login(email, password);
// Identify the user
analytics.identify({
identification: user.id,
email: user.email,
plan: user.plan,
last_login: new Date().toISOString()
});
// Track login event
analytics.funnel('user_logged_in');
}On Page Load (for authenticated users)
Identify users on every page load if they're already authenticated:
// In your app initialization
async function initializeApp() {
// Initialize analytics
analytics.init('YOUR_API_KEY');
// Check if user is authenticated
const currentUser = await getCurrentUser();
if (currentUser) {
// Identify authenticated user
analytics.identify({
identification: currentUser.id,
email: currentUser.email,
plan: currentUser.plan
});
}
}Best Practices
Use Consistent User IDs
Always use the same identifier for each user. Use your database's primary key or a UUID, not email addresses which can change.
Identify Early and Often
Call identify() as soon as you know who the user is, and update properties whenever they change.
Don't Store Sensitive Data
Never include passwords, credit card numbers, or other sensitive personal information in user properties.
Keep Properties Updated
User properties should reflect the current state. Update them when plans change, features are enabled, or milestones are reached.
Use Properties for Segmentation
Include properties that help you answer business questions: Which plan converts best? Which signup source has highest retention? What company size is our ideal customer?