diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 0932048cf..27c9e2f53 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -478,7 +478,7 @@ export class PostHog { // isUndefined doesn't provide typehint here so wouldn't reduce bundle as we'd need to assign // eslint-disable-next-line posthog-js/no-direct-undefined-check if (config.bootstrap?.distinctID !== undefined) { - const uuid = this._create_device_id() + const uuid = this.config.get_device_id(uuidv7()) const deviceID = config.bootstrap?.isIdentifiedID ? uuid : config.bootstrap.distinctID this.persistence.set_property(USER_STATE, config.bootstrap?.isIdentifiedID ? 'identified' : 'anonymous') this.register({ @@ -520,7 +520,7 @@ export class PostHog { // There is no need to set the distinct id // or the device id if something was already stored // in the persistence - const uuid = this._create_device_id() + const uuid = this.config.get_device_id(uuidv7()) this.register_once( { @@ -2065,10 +2065,6 @@ export class PostHog { } } - private _create_device_id(): string { - return this.config.get_device_id(uuidv7()) - } - /** * Opt the user in to data capturing and cookies/localstorage for this PostHog instance * If the config.opt_out_persistence_by_default is set to false, the SDK persistence will be enabled.