> For the complete documentation index, see [llms.txt](https://docs.growlytics.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.growlytics.in/integration/browser/identify-customers.md).

# 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.growlytics.in/integration/browser/identify-customers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
