diff --git a/src/constants.ts b/src/constants.ts index e434fbff1..cbc360d23 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -51,9 +51,9 @@ export const TOOLBAR_CONTAINER_CLASS = 'toolbar-global-fade-container' /** * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION - * sentinel value for distinct id, signals that the server should replace it with a hash + * Sentinel value for distinct id, device id, session id. Signals that the server should generate the value * */ -export const SENTINEL_COOKIELESS_SERVER_HASH = '$sentinel_cookieless_server_hash' +export const COOKIELESS_SENTINEL_VALUE = '$posthog_cklsh' export const WEB_EXPERIMENTS = '$web_experiments' diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 11ac097fb..ab4e2809c 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -19,7 +19,7 @@ import { PEOPLE_DISTINCT_ID_KEY, USER_STATE, ENABLE_PERSON_PROCESSING, - SENTINEL_COOKIELESS_SERVER_HASH, + COOKIELESS_SENTINEL_VALUE, } from './constants' import { SessionRecording } from './extensions/replay/sessionrecording' import { Decide } from './decide' @@ -1538,7 +1538,7 @@ export class PostHog { this.persistence?.set_property(USER_STATE, 'anonymous') this.sessionManager?.resetSessionId() const uuid = this.config.__use_cookieless_server_hash - ? SENTINEL_COOKIELESS_SERVER_HASH + ? COOKIELESS_SENTINEL_VALUE : this.config.get_device_id(uuidv7()) this.register_once( { @@ -2058,7 +2058,7 @@ export class PostHog { private _create_device_id(): string { if (this.config.__use_cookieless_server_hash) { - return SENTINEL_COOKIELESS_SERVER_HASH + return COOKIELESS_SENTINEL_VALUE } return this.config.get_device_id(uuidv7()) } diff --git a/src/sessionid.ts b/src/sessionid.ts index 513593db6..83d906c58 100644 --- a/src/sessionid.ts +++ b/src/sessionid.ts @@ -1,5 +1,5 @@ import { PostHogPersistence } from './posthog-persistence' -import { SENTINEL_COOKIELESS_SERVER_HASH, SESSION_ID } from './constants' +import { COOKIELESS_SENTINEL_VALUE, SESSION_ID } from './constants' import { sessionStore } from './storage' import { PostHogConfig, SessionIdChangedCallback } from './types' import { uuid7ToTimestampMs, uuidv7 } from './uuidv7' @@ -231,7 +231,7 @@ export class SessionIdManager { const activityTimeout = !readOnly && Math.abs(timestamp - lastTimestamp) > this.sessionTimeoutMs if (noSessionId || activityTimeout || sessionPastMaximumLength) { if (this.config.__use_cookieless_server_hash) { - sessionId = SENTINEL_COOKIELESS_SERVER_HASH + sessionId = COOKIELESS_SENTINEL_VALUE } else { sessionId = this._sessionIdGenerator() }