Add new user signup event tracking in PostHog (#8412)
This commit is contained in:
parent
1127db0514
commit
1ed68a718f
6 changed files with 79 additions and 14 deletions
|
@ -72,11 +72,11 @@ export interface IMatrixClientPeg {
|
|||
* If we've registered a user ID we set this to the ID of the
|
||||
* user we've just registered. If they then go & log in, we
|
||||
* can send them to the welcome user (obviously this doesn't
|
||||
* guarentee they'll get a chat with the welcome user).
|
||||
* guarantee they'll get a chat with the welcome user).
|
||||
*
|
||||
* @param {string} uid The user ID of the user we've just registered
|
||||
*/
|
||||
setJustRegisteredUserId(uid: string): void;
|
||||
setJustRegisteredUserId(uid: string | null): void;
|
||||
|
||||
/**
|
||||
* Returns true if the current user has just been registered by this
|
||||
|
@ -139,7 +139,8 @@ class MatrixClientPegClass implements IMatrixClientPeg {
|
|||
public setJustRegisteredUserId(uid: string | null): void {
|
||||
this.justRegisteredUserId = uid;
|
||||
if (uid) {
|
||||
window.localStorage.setItem("mx_registration_time", String(new Date().getTime()));
|
||||
const registrationTime = Date.now().toString();
|
||||
window.localStorage.setItem("mx_registration_time", registrationTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +157,7 @@ class MatrixClientPegClass implements IMatrixClientPeg {
|
|||
}
|
||||
|
||||
try {
|
||||
const registrationTime = parseInt(window.localStorage.getItem("mx_registration_time"));
|
||||
const registrationTime = parseInt(window.localStorage.getItem("mx_registration_time"), 10);
|
||||
const diff = Date.now() - registrationTime;
|
||||
return (diff / 36e5) <= hours;
|
||||
} catch (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue