--- title: "Track User Authentication" slug: "mapp-intelligence-ios-sdk-v5-track-user-authentication" updated: 2026-04-30T12:17:08Z published: 2026-04-30T12:17:08Z canonical: "docs.mapp.com/mapp-intelligence-ios-sdk-v5-track-user-authentication" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.mapp.com/llms.txt > Use this file to discover all available pages before exploring further. # Track User Authentication Use this page to instrument the authentication flow in your iOS app — login, logout, and registration. The SDK does not provide dedicated authentication APIs; instead, you use [action events](/v1/docs/mapp-intelligence-ios-sdk-v5-events) for the moments themselves and [user categories](/v1/docs/mapp-intelligence-ios-sdk-v5-users) to attach the user identity once login succeeds. Before you start, complete the [Quickstart](/v1/docs/mapp-intelligence-ios-sdk-v5-quickstart) so the SDK is initialized. --- ## What to track | Moment | How to track | | --- | --- | | Login successful | `trackAction(MIActionEvent("Login"))` with attached `MIUserCategories` carrying `customerId`. | | Login failed | `trackAction(MIActionEvent("LoginFailed"))` with optional event parameters describing the reason. | | Logout | `trackAction(MIActionEvent("Logout"))`. Optionally [reset the SDK singleton](/v1/docs/mapp-intelligence-ios-sdk-v5-reset-sdk-singleton) if you want to drop session continuity. | | Registration | `trackAction(MIActionEvent("Registration"))` with the new user's `customerId` via `MIUserCategories`. | --- ## Example: track a successful login **Swift** ```swift let user = MIUserCategories(customProperties: nil) user.customerId = "user-12345" let action = MIActionEvent(name: "Login") action.userCategories = user MappIntelligence.shared()?.trackAction(action) ``` **Objective-C** ```objectivec MIUserCategories *user = [[MIUserCategories alloc] initWithCustomProperties:nil]; user.customerId = @"user-12345"; MIActionEvent *action = [[MIActionEvent alloc] initWithName:@"Login"]; action.userCategories = user; [[MappIntelligence shared] trackAction:action]; ``` --- ## Example: track logout **Swift** ```swift MappIntelligence.shared()?.trackAction(MIActionEvent(name: "Logout")) ``` **Objective-C** ```objectivec [[MappIntelligence shared] trackAction:[[MIActionEvent alloc] initWithName:@"Logout"]]; ``` --- ## Privacy notes - Only attach `MIUserCategories` after the user has consented to analytics tracking. - If [Anonymous Tracking](/v1/docs/mapp-intelligence-ios-sdk-v5-anonymous-tracking) is enabled, do not include personally identifiable user data in `MIUserCategories`. - Use `customerId` as a stable, internal identifier — not the user's email. --- ## Related - [Quickstart](/v1/docs/mapp-intelligence-ios-sdk-v5-quickstart) - [Events](/v1/docs/mapp-intelligence-ios-sdk-v5-events) - [Users](/v1/docs/mapp-intelligence-ios-sdk-v5-users) - [User Matching](/v1/docs/mapp-intelligence-ios-sdk-v5-user-matching) - [Anonymous Tracking](/v1/docs/mapp-intelligence-ios-sdk-v5-anonymous-tracking)