DavidWells / analytics

Lightweight analytics abstraction layer for tracking page views, custom events, & identifying visitors
https://getanalytics.io
MIT License
2.47k stars 245 forks source link

Allow to set identify to null #446

Closed mptasinski closed 1 month ago

mptasinski commented 3 months ago

Current implementation of analytics.identify() does't allow to set userId back to null

The only way i manage to reset userId is with analytics.reset() but it clears annonymouseId and thats what i dont want.

if i can simply run analytics.identify(null); and it will set userId back to null it will be great

thank you

DavidWells commented 1 month ago

Probably not gonna change this in core

You can use the storage events https://getanalytics.io/lifecycle/#storage-events to prevent values from being removed or keep the id's in memory with analytics.getState()' and useanalytics.setAnonymousId`