# identify

Learn how to associate the current session with a user.

This method identifies the visitor with an identifier that is unique to your application.

It generates a token for the user and reconciles the visitor session accordingly. The token is [signed](/explanation/application/signed-tokens) when the API key carries a private key, and [unsigned](/explanation/application/signed-tokens#unsigned-tokens) otherwise. If the user ID changes during a session, the current session is terminated and a new one is started.

For more information, see [Data collection](/reference/sdk/php/data-collection).

## Signature

This method has the following signature:

```php
public function identify(string $userId): void
```

## Example

Here is a basic example of how to use this method:

```php
<?php
use Croct\Plug\Croct;

$croct = Croct::fromDotenv();
$croct->identify('john-doe');
```

## Parameters

The following list describes the supported parameters:

- `userId`: `string`

  The ID that uniquely identifies the user in your application.

  You can use any unique identifier, such as an email address, a username, or a customer ID.
