@grainql/analytics-web/react. Every block uses Analytics Web. trackSignup sends the
signup event and trackLogin sends the login event. login and logout set and clear
the user ID. Read Identify users.
Signup
CalltrackSignup with the result of the signup. On success, call login with the new user ID
and set the properties that the dashboard segments by. trackSignup takes method, source,
plan, success, and errorMessage.
login runs before trackSignup, so the signup event holds the new user ID.
Login
trackLogin takes method, success, errorMessage, loginAttempt, rememberMe, and
twoFactorEnabled. Count the attempts in the component, so a failed login and the retry after
it show as one sequence.
authToken. login({ userId, authToken })
switches the client to the JWT strategy. Read Authentication.
Social login
The provider name goes inmethod. The rest of the flow is the same as the email login.
Logout
Track the logout while the user ID is still set, with{ flush: true }. Then call logout.
logout clears the user ID and returns the client to an anonymous ID.
Password reset
There is no template method for a password reset. Usetrack. The visitor is not logged in,
so the event holds the anonymous ID.
createUser, authenticateUser, loginWithProvider, signOut, and sendPasswordResetEmail
are functions of your app. Read Template events.