Skip to main content
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.

Identify a user

Both id and email are required. This adds or updates a user in your Vero data store.
vero.tracker.user.identify({
    id: "<USER_ID_HERE>",
    email: "<USER_EMAIL_HERE>"
})
You can attach additional channels or custom data to the user profile:
vero.tracker.user.identify({
    id: "<USER_ID_HERE>",
    email: "<USER_EMAIL_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.
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:
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.
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.
vero.tracker.user.alias({
    newId: "<NEW_USER_ID_HERE>"
})

Add or remove tags

vero.tracker.tag.edit({
    add: ["<TAG_NAME_HERE>"],
    remove: ["<TAG_NAME_HERE>"]
})

Unsubscribe a user

vero.tracker.user.unsubscribe()

Resubscribe a user

vero.tracker.user.resubscribe()

Delete a user

vero.tracker.user.delete()