Describe the bug
The client_session entity requires that the userId value be provided as a string matching a pattern (^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$|^[0-9a-f]{16}$) and the sessionId be provided as a UUID.
In the JS tracker, this value is usually populated with what would be the Domain User ID value and Session ID values, respectively.
To accommodate this, when creating the client_session entity, the tracker does a few compatibility checks for anonymousTracking to ensure it produces valid data.
Mostly the checks are:
If anonymous tracking is enabled without withSessionTracking, do not include the entity at all as both userId and sessionId values are unavailable
If anonymous tracking is enabled with withSessionTracking, use the nil UUID in place of domain user ID to pass validation
However, if stateStorageStrategy is none (via initial configuration or toggling via enableAnonymousTracking) but anonymousTracking is not enabled (possible in the latter case by providing options: false), these checks will pass, but the tracker will populate userId and sessionId with an empty string as the respective identifiers are not available. The resulting event will fail schema validation.
Describe the bug The client_session entity requires that the
userId
value be provided as a string matching a pattern (^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$|^[0-9a-f]{16}$
) and thesessionId
be provided as a UUID. In the JS tracker, this value is usually populated with what would be the Domain User ID value and Session ID values, respectively. To accommodate this, when creating theclient_session
entity, the tracker does a few compatibility checks for anonymousTracking to ensure it produces valid data.Mostly the checks are:
withSessionTracking
, do not include the entity at all as bothuserId
andsessionId
values are unavailablewithSessionTracking
, use the nil UUID in place of domain user ID to pass validationHowever, if
stateStorageStrategy
isnone
(via initial configuration or toggling viaenableAnonymousTracking
) butanonymousTracking
is not enabled (possible in the latter case by providingoptions: false
), these checks will pass, but the tracker will populateuserId
andsessionId
with an empty string as the respective identifiers are not available. The resulting event will fail schema validation.To Reproduce
Expected behavior Valid event produced by omitting client_session entity or falling back to nil UUID for user/session IDs.
Screenshots Event fails validation on client_session entity:
Additional context See Zendesk #40198