Skip to main content

Overview

All the activity you track in your application is associated with a visitor who may or may not have a known identity. When a user signs in, you can send an Identify event. This associate all their past and future activity with a known Person (and optionally a Company) in Unify.

Prerequisites

Walkthrough

Identify on login

Call identify as soon as the user is authenticated. Include useful traits for the person and (optionally) the company they belong to.
// Determine the current user however you normally do so
const currentUser = getCurrentUser();

// Send an "Identify" event
unify.identify(currentUser.emailAddress, {
  // Link this visitor to a Person
  person: {
    email: currentUser.emailAddress,
    first_name: currentUser.firstName,
    last_name: currentUser.lastName,
  },

  // If possible, link this visitor to a Company as well
  company: currentUser.organization
    ? {
        domain: currentUser.organization.domain,
        name: currentUser.organization.name,
      }
    : undefined,
});

Send custom event (optional)

You may also want to track that the user logged in. Identify events link visitors to people or companies, but they don’t record an activity that can be seen or used in Unify. If you want to see when users login or filter Plays based on login activity, you should also send a custom event.
unify.track('User Logged In');
As with all custom events, you can also include additional properties to provide more context about the login.

Capture interactions

Now that visitors to your application are identified, you can start tracking key in-app interactions to power Plays. For more information, see Capture user interactions.