2

SaaS event tracking

This tutorial will help you get started sending data from your SaaS product to Segment and any of our integrations. As soon as you’re setup you’ll be able to turn on any new integrations with the flip of a switch!

The mistake most people make when installing tracking for SaaS is trying to record everything immediately. Adding tracking on an iterative cycle leads to quick wins and a much better analytics system. The following guide is meant to be the first cycle in your tracking setup, so let’s keep things simple.

Step 1: Page Tracking

Start by adding the basic Segment snippet to your site and watch as pageviews start showing up on your live debugger.

Next, you’ll want to name a few of your most important pages. To do this simply replace the empty page call in your snippet:

analytics.page();

With a named page call:

analytics.page('Pricing');

NOTE: Make sure you keep the empty page call in the snippet for pages you don’t give a specific name to. A call to page on each new page is required to load many of our client-side integrations.

The most common named pages for a SaaS business are: Home, Features, Pricing, Signup, Docs. Eventually you’ll probably name more pages, but keep it simple for now.

Step 2: Identify Users

Once a user signs up for your service you’ll want to identify them. This is important to merge together their activity across devices or if they clear their cookies. If you can, include an email address as a user trait so you can try out all the email tools on the Segment platform.

Keep things simple and choose 3-5 key user traits you know about the user. More traits can be added later and you can update trait values as they change by callingidentify again.

Here are the most common traits we see for SaaS businesses: name, email, createdAt, plan, website. If you choose to stick with these traits your identify call will look like this:

analytics.identify('12345',{
  name: 'Kobe Bryant',
  email: 'kobe@lakers.com',
  createdAt: new Date('2009-07-20T22:55:29.000Z'),
  plan: 'Gold',
  website: 'lakers.com'
});

Read our guide on identifying new users for more best practices.

Step 3: Key Events

Start off with 3-5 key events you really want to track. Remember, this is an iterative cycle. Trying to track every single action right away is a daunting task that can drag out the process and lead to a poor tracking setup.

To record your key events use the track method. For simplicity it’s usually easiest to get started with our client-side javascript library: Analytics.js. And don’t worry about tracking event properties quite yet.

Here’s a list of the most common key events for a SaaS business:

  • Email List Joined
  • Account Created
  • Teammate Invited
  • Feature 1 Used
  • Feature 2 Used

In this case Key Feature 1 & Key Feature 2 should be replaced by the most important features in your product. Here’s a basic example of a track call:

analytics.track('Account Created');

Step 4: Track Revenue

The last thing you’ll need to track is revenue and the events around it. If you’re following our advice and keeping things simple it’s easiest to start with charges, then later you can add in refunds, cancellations, upgrades, etc.

Check out our guide for tracking recurring revenue for SaaS revenue best practices.