Skip to content

Commit

Permalink
Revert get device id changes
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-c committed Dec 12, 2024
1 parent 71d5093 commit 7a2f555
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/posthog-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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(
{
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7a2f555

Please sign in to comment.