amplitude / amplitude/Amplitude-TypeScript

Delay events until `BrowserClient` is initialised

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

描述

## Summary

The `init` method of `BrowserClient` is async. While the initialisation is ongoing, the application can already track events. These events will then not be processed by plugins.

With the `dispatchQ` in the `CoreClient` there is already a mechanism to buffer events. However tracked events are only put on the queue while `CoreClient` is initialising (`isReady === false`). The queue however is [processed](https://github.com/amplitude/Amplitude-TypeScript/blob/f0e35ac0700f90c38672c2bfa1c239d50c7181e2/packages/analytics-browser/src/browser-client.ts#L160) when the `BrowserClient` is done initialising.

## Motivations
In our tracking setup we have the issue that events are tracked before the `BrowserClient` is fully initialised. We rely on a custom plugin to run first to ensure user properties are populated.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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