amplitude / amplitude/Amplitude-TypeScript

Ability to add custom identity storage provider in @amplitude/analytics-browser@v2.0.0

Open
#448 6 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
180
Forks
68
Avg merge
3d 1h
Merged PRs (30d)
29

Description

## Summary
The `cookieStorageProvider` property was removed in v2.0.0 of the Browser SDK, so this blocks us from being able to specify a custom storage provider for GDPR compliance purposes. It would be amazing if the SDK provided this type of functionality out of the box (e.g. `switchIdentityStorage`) or added a `custom` option to `identityStorage` so folks can provide custom storage providers again.

## Motivations
For GDPR compliance, we would like to track users using memory storage and then switch to cookies only after users have provided their consent to use tracking cookies. We were able to do this in `@amplitude/analytics-browser@v1.0.0` by creating a custom `Storage` instance (https://github.com/MystenLabs/sui/blob/main/apps/core/src/utils/persistableStorage.ts) and using that for the `cookieStorageProvider` property. We're aware of the default recommended solution of deferring the initialization of Amplitude until users have provided consent, but that isn't quite the same and we miss out on potentially useful insights.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.