fullstory-register-user

- [Fullstory-Register-User](#fullstory-register-user) - [Issue And Solution](#issue-and-solution) - [How to use](#how-to-use) - [Passing Options](#passing-options) - [User](#user) - [Addtional Info](#addtional-info)

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
fullstory-register-user
0.3.34 months ago4 months agoMinified + gzip package size for fullstory-register-user in KB

Readme

Contents
- Fullstory-Register-User - Issue And Solution - How to use - Passing Options - User - Addtional Info
Fullstory-Register-User
This React component is for registering the user to Fullstory with their name and email. Passing additional parameters is optional.

Issue And Solution

When the user signs in the first time to an app, Fullstory would log an anonymous user because of the redirect needed for signing in the user. This component eliminates the anonymous user being logged because it waits for the user to be authenticated before registering Fullstory and passing it the user.

How to use

npm i fullstory-register-user

import { Auth0Provider, User, useAuth0 } from "@auth0/auth0-react";
import { RegisterUser } from 'fullstory-register-user';

const AuthenticatedRoutes = () => {
  const { isLoading, isAuthenticated, user, loginWithRedirect, error } = useAuth0();

  if ( isLoading ) {
    return <div >loading...</div>;
  }
  if ( error ) {
    return <div>Oops... { error.message }</div>;
  }
  if ( isAuthenticated ) {
    return (
        <>
            <RegisterUser user={ user } org={ "YOUR FULLSTORY ID" } />
            <Switch>
                <Route exact path="/" render={()=> <PrivateComponent />}/>
                <Route exact path="/other" render={()=> <OtherComponent />}/>
            </Switch>
        </>
    );
  } else {
    loginWithRedirect();
    return null;
  }
};

Passing Options

| Options | Default | Required | Result | | ----------- | ----------- |----------- | ----------- | | user| null | true | The user to be registered with Fullstory| | org | null | true | Registers Fullstory | | env | null | false | Specifies what NODEENV to register Fullstory. If no env is specified then all NODEENV are registered. |

User

The user object is what is passed to Fullstory Identify. The user must have an id, name and email in order to register that user to Fullstory. any additonal parameters are optional.
| Options | Default | Required | Result | | ----------- | ----------- |----------- | ----------- | | id | null | true | uid is a string containing a unique identifier for the current user | | name | null | true | Name of user | | email | null | true | Email of user |

Additional Info

  • All React dependencies for Fullstory-Register-User are dependent on the application using the component. This is to avoid any version dependency conflicts.
  • The Fullstory dependency uses "react-fullstory": "^1.4.0" for registering the user.