Description
Summary
Allow passing custom storage implementation to identityStorage
option instead of only supporting predefined types:
cookie
localStorage
sessionStorage
none
// Proposed API
amplitude.init(API_KEY, undefined, {
identityStorage: new MyCustomStorageImplementation() // Custom implementation of Storage<UserSession>
});
Motivations
Consistent session tracking between background script, sidepanel, and website is critical for accurate analytics. Sessions currently break across these contexts because Amplitude doesn't support Chrome's extension-specific storage APIs.
Background scripts, sidepanel, and website can all access shared storage through Chrome's extension APIs (chrome.cookies
, etc.), but Amplitude only supports standard web storage mechanisms which don't work across extension contexts.
Allowing custom storage implementations would enable developers to implement consistent session tracking using Chrome's extension APIs without requiring Amplitude to include extension-specific dependencies in their core package.