amplitude / amplitude/Amplitude-TypeScript

identityStorage prop not being respected

Aperta
#603 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
TypeScript
Stelle
180
Fork
68
Merge medio
3g 1h
PR unite (30g)
29

Descrizione

## 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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.