> 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/rest-apis/tracking-users.md).

# Tracking Users (Shopify Only)

{% hint style="warning" %}
Use this apis if you are using shopify.
{% endhint %}

With user tracking APIs, you can create a new user or update existing users. For each customer being created/updated you will need to provide a unique identifier of this customer. The identifier can be a customer's email id or mobile number or Shopify customer id if you have one.

## /track/user

<mark style="color:green;">`POST`</mark> `https://dc.growlytics.in/track/user`&#x20;

Using `/track/user` API, you can create or update the customer. If the customer already exists with a given unique id, the customer will be updated, otherwise, a new customer will be created.

#### Headers

| Name             | Type   | Description        |
| ---------------- | ------ | ------------------ |
| x-growlytics-key | string | Growlytics API Key |

#### Request Body

| Name       | Type   | Description                                                                                                                                                                                                 |
| ---------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| attributes | object | Key-value pairs. Customer's dynamic attributes. `name`, `email` and `mobile`C are reserved attributes. If you are mentioning the user's email or mobile or full name, please use these reserved attributes. |
| id         | string | Customer's unique id. If the customer already exists with a given unique id, the customer will be updated. Otherwise, a new customer will be created.                                                       |

{% tabs %}
{% tab title="200 ​​​When customer is successfully created or updated." %}

```
{
    success: true
}
```

{% endtab %}

{% tab title="422 When invalid input is provided. You will get reponse with details of what exactly is wrong. " %}

```
```

{% endtab %}
{% endtabs %}

## API Example

{% tabs %}
{% tab title="Node JS" %}

```javascript
// Prepare Request input data 
const requestBody = { 
    id: 'lksjfiwowior',    // Customer's unique identifier.
    attributes:{
        // Reserved attributes, used for campaigns.
        name: 'John Wick',
        email: 'john@gmail.com',
        mobile: '9876543210',

        // Add your own custom customer variables here, ie:
        subscriptionType: 'pro',
        region: 'Mumbai',
        totalPurchaseTillNow: 30000
    }
};

// Call API
const request = require('request-promise');
request({
    method: 'POST',
    uri: 'https://dc.growlytics.in/track/user',
    headers: {
        Accept: 'application/json',
        'x-growlytics-key': '<GROWLYTICS-API-KEY>'
    },
    body: requestBody
});
```

{% endtab %}
{% endtabs %}

## Terms & Considerations

1. *Custom Attribute* names must be less than 50 characters.
2. *Custom Attribute* names are case-sensitive.
3. Allowed data types for event attributes:`String`, `Number`, `Boolean`, `Date`&#x20;
4. A maximum of 50 *Event Attributes* allowed per custom even&#x74;*.*
5. In a Customer Profile, you can set a maximum number of 50 custom attributes.
6. Data types of each attributes are defined when they are tracked for the first time. For the second time, if the data type is not matching with the original data type, attributes will be ignored.
