Identify Users & Send Tracked Events

Identifying users & letting Userpilot track events can help you create powerful user segments to target & track goals as well.

The more information you pass, the more power you will have at your hands.

Identifying Users

To pass a user attribute, you must call the userpilot.identify() function as shown below. 

  userpilot.identify( "UNIQUE USER ID", // Used to identify users 
         name: "John Doe", // Full name 
         email: "", // Email address 
         created_at: '2019-10-17', // ISO8601 Date
	 company: {
	  id: 1, // Required, used to identify the company
	  name: "Acme Labs",
	  created_at: '2019-10-17' // ISO8601 Date
         // Additional properties 
         // projectId: "1",
         // trialEnds: '2019-10-31' // ISO8601 Date

Passing date parameters

You can pass extra date parameters other than the created_at parameter using the  ISO 8601 format. 

For example, you can pass the date where the trial for a certain user ends as follows trialEnds: '2019-10-31T09:29:33.401Z'

IMPORTANT: If your user’s data changes in some way without a page load, you should call the userpilot.identify() function again.

This will cause Userpilot to check for any new changes to the user’s data. You only need to include whatever has changed—you don’t need to include all user data in each update.

Sending Tracked Events

You can send tracked events and pass them to Userpilot using the userpilot.track() function.

// You can track your events using the "Track" method 
// You can also specify more information about your event 
var meta = {URL: "/growth"}; 
userpilot.track("Page Event", meta); 
//A second example
userpilot.track("Created an Invoice", {
 number_of_invoices: 2,

It is recommended to limit the total number of unique event names and using metadata to provide additional context for each event. Ensure that the combined size of all of your unique event names does not exceed 512 KB.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.