# Track Users

## Track User Attributes

Use `Growlytics.user.push` to add/update session customer attributes. For example, when customer selects city for checking out furniture, you can update city attribute of the customer even though they haven't logged in.

{% code title="index.js" %}

```javascript
Growlytics.user.push( {
  city: 'San Francisco'
});
```

{% endcode %}

## User Login & Logout

{% hint style="info" %}
Ensure log in and log out of users are implemented correctly during the visit to your website and users are authenticated.
{% endhint %}

### Login User

Use `Growlytics.user.identify` method to associate user with Growlytics.

```javascript
Growlytics.user.identify('THE_USER_ID_IN_YOUR_APP', {
  // Reserved customer properties (Used in campaigns)
  name: 'John Wick',
  email: 'john@gmail.com',
  mobile: '9876543210',

  // Custom properties
  subscriptionType: 'pro',
  region: 'Mumbai',
  totalPurchaseTillNow: 30000
});

```

{% hint style="info" %}
name, email, and mobile are reserved keywords in the Growlytics platform. Growlytics will use these keywords to send emails, SMSes and more.
{% endhint %}

{% hint style="warning" %}
Customer id must be a string,(max 40 characters). Also, just like event tracking, Growlytics supports `Number, BigInt, String, Boolean` and `Date` data types for user attribute values. For further details refer to [event tracking considerations.](https://docs.growlytics.in/core-concepts-1/events#default-metadata-recorded-automatically)&#x20;
{% endhint %}

## Log Out <a href="#log-in-0-3" id="log-in-0-3"></a>

Use this function to forcefully log out the current user.

```javascript
Growlytics.user.logout();
```

{% hint style="warning" %}
Make sure you do `logout()` before you use `Growlytics.identify(),` or else previously identified user's data may get updated.
{% endhint %}
