Skip to content

Custom User Identification


By default, the SDK automatically generates a unique identifier ID for a user. This ID does not carry any identifying attributes and can only distinguish different user properties. Therefore, we provide additional APIs to add different identifying attributes to the current user.

Attribute Type Description
user.id string User ID
user.name string User nickname or username
user.email string User email

Note: The following attributes are optional, but it is recommended to provide at least one of them.

Adding User Identification

window.DATAFLUX_RUM && window.DATAFLUX_RUM.setUser({
    id: '1234',
    name: 'John Doe',
    email: 'john@doe.com',
})
DATAFLUX_RUM.onReady(function() {
    DATAFLUX_RUM.setUser({
        id: '1234',
        name: 'John Doe',
        email: 'john@doe.com',
    })
})
import { datafluxRum } from '@truewatchtech/browser-rum'
datafluxRum.setUser({
    id: '1234',
    name: 'John Doe',
    email: 'john@doe.com',
})

Removing User Identification

window.DATAFLUX_RUM && window.DATAFLUX_RUM.clearUser()
DATAFLUX_RUM.onReady(function() {
    DATAFLUX_RUM.clearUser()
})
import { datafluxRum } from '@truewatchtech/browser-rum'
datafluxRum.clearUser()