setDeviceId

The setDeviceId() method sets a custom device ID.

Syntax

tracker.deviceId = deviceID
getTracker().setDeviceId(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:

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

Notes

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

Related methods