setDeviceId

The setDeviceId() method sets a custom device ID.

Syntax

getTracker().setDeviceId(deviceID)
tracker.deviceId = deviceID

Parameters

deviceID (string, optional)

A custom device ID. If the value is not set, an automatic value is generated.

Examples

To set a device ID to ABC123:

getTracker().setDeviceId(ABC123)
tracker.deviceId = ABC123

Notes

  • The device ID won’t be sent if setAnonymizationState(true) is set.

Related methods