# identify()

Associates a user ID with the current user for analytics and user tracking.

> **Info**

Call this method after a user logs in to track their subscription status and user attributes across devices.



Purpose [#purpose]

Associates a user ID with the current user to enable cross-device tracking and user-specific analytics.

Signature [#signature]

```dart
Future<void> identify(String userId, [IdentityOptions? options])
```

Parameters [#parameters]

<TypeTable
  type="{
  userId: {
    type: &#x22;String&#x22;,
    description: &#x22;A unique identifier for the user.&#x22;,
    required: true,
  },
  options: {
    type: &#x22;IdentityOptions?&#x22;,
    description: &#x22;Optional configuration for identity behavior.&#x22;,
  },
}"
/>

Returns / State [#returns--state]

Returns a `Future<void>` that completes when the user identification is finished.

Usage [#usage]

Basic identification:

```dart
await Superwall.shared.identify('user_123');
```

After user login:

```dart
Future<void> _onUserLogin(String email, String password) async {
  // Authenticate user
  final user = await AuthService.login(email, password);
  
  // Identify user to Superwall
  await Superwall.shared.identify(user.id);
  
  // Set additional user attributes
  await Superwall.setUserAttributes({
    'email': user.email,
    'plan': user.subscriptionPlan,
    'signupDate': user.createdAt.toIso8601String(),
  });
}
```

With error handling:

```dart
Future<void> _identifyUser(String userId) async {
  try {
    await Superwall.shared.identify(userId);
    print('User identified successfully');
  } catch (e) {
    print('Failed to identify user: $e');
  }
}
```