# Identify Method

### Overview <a href="#about-the-method" id="about-the-method"></a>

The `identify` method is used to identify, create and update users in CrossEngage. This means that anytime you can relate user's actions or attributes to a recognizable user ID, you should consider triggering `identify` e.g. when a user logs in, updates their profile or signs up for a newsletter.

You do not need to call `identify` for anonymous visitors of your website as CrossEngage automatically assigns them an anonymous `xngGlobalUserId`.

{% hint style="warning" %}
Personal information can be sent via web tracking but we recommend to transmit sensitive information (like address, telephone etc) per API or upload via feed.
{% endhint %}

The `identify` method has the following structure for updating users based on their `externalId` (default):

```
ce('identify', '123abc');
```

For cases when you may not have access to the `externalId`, CrossEngage allows you to identify users using `email`

```
ce('identify', {email: 'me@emailprovider.com'});
```

{% hint style="info" %}
Please note that CrossEngage automatically fills the businessUnit property with an empty string when it is not provided. This will prevent the duplication of profiles with the same email address which do not have a business unit
{% endhint %}

If you are using business units in your CrossEngage instance, you also need to provide the respective `businessUnit` when identifying users via `email` .

```
var attributes = {
    "email": "john@xng.com",     
    "businessUnit": "DE"
    }; ​

ce('identify', attributes);
```

## Implementation <a href="#implementation" id="implementation"></a>

**id** or **email** (and if used also **businessUnit)** needs to be available in your data layer before you fire the request to us. If not, this might lead to incorrect mapping.

This section goes through the methods that can be used for user identification in cases where an id is known and when it is not.

### Identify users with an id <a href="#identify-users-with-an-id" id="identify-users-with-an-id"></a>

```
ce('identify','12345abcd');
```

1. Copy the snippet.
2. Create a custom HTML tag on your tag manager and paste the snippet.
3. Set up a trigger which fires upon a form submission, or any occasion, the user-identity is exposed.&#x20;

Using the function that listens for the form's submission, call the `identify` function with the `externalId` exposed by your website.&#x20;

### Identifying a user using email <a href="#identifying-a-user-using-email" id="identifying-a-user-using-email"></a>

For cases when you may not have access to the `externalId`, CrossEngage allows you to identify users using `email`. In this case, the `noUserId` property must have as its value `true`. This will indicate to our tracking library that the user id is not known:

```
var attributes = {
    "email": "john@xng.com",     
    "businessUnit": "DE"
    }; ​

ce('identify', attributes);
```
