> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withflock.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Customer Identification

## Overview

Customer identification is a critical first step in the Flock referral system. By identifying your users, you enable:

* Personalized referral experiences
* Accurate tracking of referral activities
* Proper attribution of rewards
* Access to user-specific campaign data

This guide explains how to implement customer identification across different platforms using Flock SDKs.

<Note>
  Always call the `identify()` method after a user logs in or when your app starts with an authenticated user. This should be done before triggering any checkpoints or showing placements.
</Note>

***

## Implementation

Use the `identify` method to link a user's identity with Flock:

<CodeGroup>
  ```swift iOS (Swift) theme={null}
  Flock.shared.identify(
      externalUserId: "<USER_ID_IN_YOUR_APP>",
      email: "user@example.com",
      name: "Alice Smith",
      customProperties: [
        "tier": .string("Pro"),
        "subscription": .string("annual")
      ]
  )
  ```

  ```kotlin Android (Kotlin) theme={null}
  CoroutineScope(Dispatchers.Main).launch {
      FlockSDK.identify(
          externalUserId = "<USER_ID_IN_YOUR_APP>",
          email = "user@example.com",
          name = "Alice Smith",
          customProperties = mapOf(
              "tier" to "pro",
              "subscription" to "annual"
          )
      )
  }
  ```

  ```tsx React Native theme={null}
  import { useFlockSDK } from '@wflock/react-native-sdk';

  const handleLoginSuccess = async (user) => {
    const { identify } = useFlockSDK();
    await identify({
      externalUserId: user.id,
      email: user.email,
      name: user.name,
      // Optional custom properties
      customProperties: {
        tier: 'premium',
        subscriptionType: 'annual'
      }
    });
  };
  ```

  ```javascript Web theme={null}
  await window.FlockSDK.shared.identify({
    externalUserId: 'user_123',
    email: 'user@example.com',
    name: 'User Name',
    // Optional custom properties
    customProperties: {
      tier: 'pro',
      subscriptionType: 'monthly'
    }
  });
  ```
</CodeGroup>

***

## Parameters

| Parameter          | Type   | Required | Description                                        |
| ------------------ | ------ | -------- | -------------------------------------------------- |
| `externalUserId`   | String | Yes      | Your unique identifier for the user in your system |
| `email`            | String | Yes      | User's email address                               |
| `name`             | String | Yes      | User's full name                                   |
| `customProperties` | Object | No       | Additional user attributes for segmentation        |

### About `externalUserId`

The `externalUserId` is the primary identifier that links your user in your system to their profile in Flock:

* It should be unique and stable for each user
* Typically, this is the same ID you use in your database

### Custom Properties

Custom properties allow you to segment users and personalize referral experiences:

* Use them to track user attributes like subscription tier, user type, or purchase history
* These properties can be used for targeting specific user segments in campaigns
* Format varies slightly by platform (see examples above)

<Note>
  Custom properties should be simple key-value pairs. Complex nested objects are not supported.
</Note>

***

## Best Practices

1. **Call Early:** Identify users as early as possible in your app's lifecycle
2. **Consistent IDs:** Use the same `externalUserId` across all platforms for the same user
3. **Update on Changes:** Re-identify users when their information changes
4. **Privacy First:** Only send necessary user information
5. **Error Handling:** Implement proper error handling around identification calls

***

## Next Steps

After successfully identifying your users, you can:

1. [Trigger checkpoints](/checkpoints/intro) to show referral experiences
2. [Display placements](/checkpoints/placement) at strategic moments
3. [Trigger rewards](/checkpoints/reward) for completed referrals

For additional help, contact [support@withflock.com](mailto:support@withflock.com).
