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
|
@ -33,6 +33,7 @@ import Field from '../elements/Field';
|
|||
import RegistrationEmailPromptDialog from '../dialogs/RegistrationEmailPromptDialog';
|
||||
import CountryDropdown from "./CountryDropdown";
|
||||
import PassphraseConfirmField from "./PassphraseConfirmField";
|
||||
import { PosthogAnalytics } from '../../../PosthogAnalytics';
|
||||
|
||||
enum RegistrationField {
|
||||
Email = "field_email",
|
||||
|
@ -147,6 +148,8 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
|
|||
};
|
||||
|
||||
private doSubmit(ev) {
|
||||
PosthogAnalytics.instance.setAuthenticationType("Password");
|
||||
|
||||
const email = this.state.email.trim();
|
||||
|
||||
const promise = this.props.onRegisterClick({
|
||||
|
|
|
@ -18,6 +18,7 @@ import React from "react";
|
|||
import { chunk } from "lodash";
|
||||
import classNames from "classnames";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { Signup } from "matrix-analytics-events/types/typescript/Signup";
|
||||
|
||||
import PlatformPeg from "../../../PlatformPeg";
|
||||
import AccessibleButton from "./AccessibleButton";
|
||||
|
@ -25,6 +26,7 @@ import { _t } from "../../../languageHandler";
|
|||
import { IdentityProviderBrand, IIdentityProvider, ISSOFlow } from "../../../Login";
|
||||
import AccessibleTooltipButton from "./AccessibleTooltipButton";
|
||||
import { mediaFromMxc } from "../../../customisations/Media";
|
||||
import { PosthogAnalytics } from "../../../PosthogAnalytics";
|
||||
|
||||
interface ISSOButtonProps extends Omit<IProps, "flow"> {
|
||||
idp: IIdentityProvider;
|
||||
|
@ -50,6 +52,26 @@ const getIcon = (brand: IdentityProviderBrand | string) => {
|
|||
}
|
||||
};
|
||||
|
||||
const getAuthenticationType = (brand: IdentityProviderBrand | string): Signup["authenticationType"] => {
|
||||
switch (brand) {
|
||||
case IdentityProviderBrand.Apple:
|
||||
return "Apple";
|
||||
case IdentityProviderBrand.Facebook:
|
||||
return "Facebook";
|
||||
case IdentityProviderBrand.Github:
|
||||
return "GitHub";
|
||||
case IdentityProviderBrand.Gitlab:
|
||||
return "GitLab";
|
||||
case IdentityProviderBrand.Google:
|
||||
return "Google";
|
||||
// Not supported on the analytics SDK at the moment.
|
||||
// case IdentityProviderBrand.Twitter:
|
||||
// return "Twitter";
|
||||
default:
|
||||
return "SSO";
|
||||
}
|
||||
};
|
||||
|
||||
const SSOButton: React.FC<ISSOButtonProps> = ({
|
||||
matrixClient,
|
||||
loginType,
|
||||
|
@ -62,6 +84,8 @@ const SSOButton: React.FC<ISSOButtonProps> = ({
|
|||
const label = idp ? _t("Continue with %(provider)s", { provider: idp.name }) : _t("Sign in with single sign-on");
|
||||
|
||||
const onClick = () => {
|
||||
const authenticationType = getAuthenticationType(idp.brand);
|
||||
PosthogAnalytics.instance.setAuthenticationType(authenticationType);
|
||||
PlatformPeg.get().startSingleSignOn(matrixClient, loginType, fragmentAfterLogin, idp?.id);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue