amplitude / amplitude/Amplitude-TypeScript

identityStorage prop not being respected

未关闭
#603 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
TypeScript
星标
180
派生
68
平均合并
3 天 1 小时
30 天内合并 PR
29

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。