Analytics For Windsor

In addition to any analytics tracking code you may already have, we have a few recommendations to make the best of Windsor

Identifying Users#

The user method on windsor-node (or when using Segment, the identify method) is the best way to add metadata to a user. They both work the same way - the only difference is the name of the method.

Call user() with any property you'd like to track about a user. Windsor needs a userId and email for most integrations to work correctly. Additionally, a value for phone will let Windsor track any text messages you send. The avatar property lets you identify users easily on Windsor.

windsor.user("user-123", {
name: "John Doe",
email: "john@example.com",
avatar: "https://avatar.windsor.io/user-123",
phone: "+1 (415) 123-4567",
});

You may track any additional properties you'd like. When deciding what to name those properties, refer to the Segment traits spec.

We recommend calling the user() method as often as possible from your app, both on the frontend and backend. This is because ad-blockers can prevent analytics events on the frontend. As a general guide, call user() -

  • On Sign up
  • On Every Login (preferably on the client and server)
  • Every time a core user property changes (name, email, avatar or phone number)
  • Upon Loading any pages that are accessible by a logged in user

Choosing a userId#

Every identified user must be assigned a unique userId so they can be tracked consistently across different browsers or devices. You should assign new users their userId at the point that they register.

We recommend using database IDs instead of simple email addresses or usernames, because database IDs never change. That guarantees that even if the user changes their email address, you can still recognize them on Windsor. And even better, you’ll be able to correlate analytics data with your own internal database.

After Identification#

After any call to user(), we strongly recommend you follow up with a call to event() (see more details on that method below). This is so you can track what the reason for a call to user was. For example, if the user just signed up, call track with windsor.event("Signed Up"). If the user updated their profile, windsor.event("Updated Profile", { favoriteColor: "black" }). The user call will actually update the user property on Windsor, but the corresponding event will explain to you what caused the change.

Tracking User Events#

The event method on windsor-node (or when using Segment, the track method) is the best way to track user events. They both work the same way - the only difference is the name of the method.

Your app should call event() for every important action a user takes. Segment has a great guide on what events are important to track for each industry.

Additionally, Windsor understands specific events to power additional features.

Documentation on these features is in progress

For now, we recommend following Segment's guide for your industry/application to get the best experience with Windsor.