amplitude / amplitude/Amplitude-TypeScript

identityStorage prop not being respected

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

Description

## Expected Behavior

- When I set `identityStorage` in the `init` config to `none`, `AMP` cookies wont be stored on browser.

## Current Behavior

When I set `identityStorage` to `none` for an existing user (who has been tracked previously) I can see that the `AMP` cookies are still being set in the browser. When I do this on incognito though, the cookies are not being set (and it uses in memory storage)

Also, the [current recommendation](https://github.com/amplitude/Amplitude-TypeScript/issues/448#issuecomment-1610270679) for updating `internalStorage` on cookie consent is to re-call the `init` function, but when using `@amplitude/analytics-browser` with the Amplitude generated event class file, you can only call `ampli.load` once (which calls the init fn), after that it throws the error:
> ERROR: Ampli is not yet initialized. Have you called ampli.load() on app start?

## Possible Solution

- `internalStorage: none` should be respected in all cases.
- Create an amplitude function to update the `internalStorage`, without having to call `init` again. eg.
```
this.amplitude.setInternalStorage('none')
```

## Environment
- JS SDK Version: 2.3.2
- Installation Method: yarn
- Browser and Version: Chrome 118

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.