> ## Documentation Index
> Fetch the complete documentation index at: https://help.getvero.com/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript SDK Reference

> Complete reference for all methods available in the Vero JavaScript/TypeScript SDK.

This page covers all methods available in the Vero JavaScript/TypeScript SDK. If you haven't set up the SDK yet, start with the [Getting Started guide](/developer-docs/getting-started).

## Identify a user

Both `id` and `email` are required. This adds or updates a user in your Vero data store.

```javascript theme={null}
vero.tracker.user.identify({
    id: "<USER_ID_HERE>",
    email: "<USER_EMAIL_HERE>"
})
```

You can attach additional channels or custom data to the user profile:

```javascript theme={null}
vero.tracker.user.identify({
    id: "<USER_ID_HERE>",
    email: "<USER_EMAIL_HERE>",
	phone_number: "<USER_PHONE_NUMBER_HERE>",
    channels: [
        {
            type: "push",
            address: "<PUSH_TOKEN_HERE>",
            platform: "android"
        }
    ],
    data: {
        first_name: "<FIRST_NAME_HERE>",
        last_name: "<LAST_NAME_HERE>"
    }
})
```

## Track an event

An event represents a user action in your application, such as viewing a product or completing a purchase.

```javascript theme={null}
vero.tracker.event.track({
    eventName: "viewed product",
    data: {
        product_name: "Red T-shirt",
        product_url: "https://www.example.com/products/red-t-shirt",
    }
})
```

You must call `user.identify` prior to calling `event.track`, unless you supply an `identity` object to the method. Once you call `user.identify`, the SDK automatically stores the `id` and `email` in the browser's local storage for future requests.

You can also pass in an optional `extras` object as outlined in the [Track REST API](/api-reference/track/overview):

```javascript theme={null}
vero.tracker.event.track({
    eventName: "viewed product",
    data: {
        product_name: "Red T-shirt",
        product_url: "https://www.example.com/products/red-t-shirt",
    },
    extras: {
        source: "My application",
        createdAt: "2023-05-30T04:46:31+0000",
    }
})
```

## Unidentify a user

Call this when a user logs out so future events are not associated with them.

```javascript theme={null}
vero.tracker.user.unidentify()
```

## Alias / merge a user

Merge two user identities into one. This is useful when an anonymous user logs in and you want to combine their activity.

```javascript theme={null}
vero.tracker.user.alias({
    newId: "<NEW_USER_ID_HERE>"
})
```

## Add or remove tags

```javascript theme={null}
vero.tracker.tag.edit({
    add: ["<TAG_NAME_HERE>"],
    remove: ["<TAG_NAME_HERE>"]
})
```

## Unsubscribe a user

```javascript theme={null}
vero.tracker.user.unsubscribe()
```

## Resubscribe a user

```javascript theme={null}
vero.tracker.user.resubscribe()
```

## Delete a user

```javascript theme={null}
vero.tracker.user.delete()
```
