Page tree
Skip to end of metadata
Go to start of metadata

Why we have this Process

Tracking user behavior is one of the key components to understanding users and product success. Analytics tools like Heap help to quickly answer business questions like "Where in my signup and onboarding funnel am I losing users?" and "Which features contribute to user retention or preventing churn (paying customers that leave)?". 

Heap Analytics core functionality is consists of three core report types: feature usage graphs, funnels, and user retention. Benefits and downsides compared to Google Analytics are:

  • HEAP automatically collects all important user events on a website: All Clicks, Pageviews and form submissions. Additionally, it can receive any (backend) event from any other tool (via segment, more on that later). This is a huge leap forward compared to older tools where you have to define every single event you want to track beforehand and you're not able to run analysis on i.e. a button click you forgot to define. 
  • In HEAP anybody can create their own reports to quickly answer any kind of business question, Google Analytics is limited to a fixed set of reports that only answer a limited set of questions and is harder to use.  Google Analytics only allows customer reports through a separate product called Data Studio which requires high investments in an expert to set up the reports. Data studio doesn’t allow users to slice and dice reports to answer underlying questions
  • In HEAP you can define and analyze any (signup/onboarding/etc) funnel you want, Google Analytics is very limited in analyzing funnels
  • Google Analytics track anonymous users using cookies and will not recognize a user who logs into the app on a different device and therefore will double count this user in all reports. Heap (either via Segment or on it's on) will identify the user with help of your app an will link all behavior across devices to behavior even from the moment before he/she was logged in. 
  • Costs: Google Analytics is free with unlimited data retention. Heap is free up to 25K monthly sessions (5K if you don't add their badge to your homepage) and has a free 3-month data retention.  For 12-month retention, the lowest "list price" is 36k$ per year (32k Euro,2.6k/month), however, I would argue this is not required for a startup before i.e. a second seed round. Additionally, via the Segment setup that we'll discuss in a moment, you'll be able to retain the most important data in a Datawarehouse.

Segment Connections is a user event integration tool and tag manager. Although tools like heap can function without Segment, most startups use segment nowadays. Functions and Benefits of Segment are:

  • Tag manager: Enable hundreds marketing and analytics tool tags without changing your code. Segment support two categories of tools: Sources and Destinations. Sources customer events into segment (i.e. mailchimp feeding mail opens), Destinations receive the events, i.e. an analytics tool, but also CRM and Support systems can receive the data so they i.e. know on which plan a customer is or what he/she did in the app. 
  • All tools integrated, without development effort. All tools can be integrated without months of development work development because they all understand the concept of a (user) Event. An event is i.e. "Read email"/"Placed Order"/"Button Click" that all have certain properties i.e. the title of email or button, the order amount, etc. Also, your own site/app can easily be integrated with all other tools with only a few lines of code for each event you want to segment. 
  • Hub for Customer Events: All customers events (i.e. place an order, read an email, did an upgrade) are sent to the segment hub and from there to all tools. Giving all tools a complete picture of the user journey. 
  • Identify a user with the same unique user-id across tools (even from before they logged in). This allows analytics tools like Heap to analyze the whole customer journey across tools without months of development work on data integration. This allows for reports like "Do support emails correlate with customers leaving (churn)?" (combining data from your support tool and subscription system) or "Did this facebook campaign lead to more users try out and buy our premium features" (combining data from Facebook ads with backend event). 
  • Automatically create your Datawarehouse: All analytics tools have their limitations, i.e. functional limitations or data retention limitations. Segment can automatically create and update your data warehouse without any development effort. This allows for further/future analysis of the data using popular BI tools.
  • Costs: Free until 1.000 Monthly unique visitors, $120/month for up to 10k.

Context and Scope

Segment: Customer Event Data integration.

Heap: Analytics for management (Dashboards, Reports) power users (creating reports). Sometimes referred to as mid-funnel analytics tools because it allows you to analyze user behavior past the top of the funnel (website visit). Defining Heap Reports/Dashboards and user training is not part of this setup process.

When should the process be performed?

One time, as soon as you have >5 weekly active users. 

Who performs the process

Setup: CTO, PM

Test: I.e. CPO/PM/CEO.

Process steps

  1. Create a segment account (using the Tool Account creation process. Short version: create and put the account in Dashlane). 
  2. Install and setup segment using this guide: (ignore step 3, tracking.)
  3. Create a HEAP Analytics account (using the Tool Account creation process. Short version: create and put the account in Dashlane). 
  4. Enable the HEAP Destination tag in segment using the App ID  the Heap setup gives you. 
  5. Apply for the Heap badge program so you get 25K free monthly visitors, if you're over 5k monthly uniques. 
  6. Create at least 2 sources for your backend, i.e.
    1. Backend Production
    2. Backend Staging
    3. Optional: HTTP API (to route any zapier event to, for tools that don't integrate out of the box with segment, but do with zapier, i.e. intercom) 
  7. Create at least 2 sources for your frontend, i.e.
    1. Frontend Production
    2. Frontend Staging
  8. Connect Heap to all 4 of more of your sources. Afterward, it should like a the image below. 
    1. Important: Be careful not to feed events from staging to the heap production environment as this cannot be undone. Connect the app Staging environments to environment with the same name in Heap. You do this by adding an environment in HEAP under and then "Projects" and clicking on "Add environment". This will give you a ID that you fill in as "App ID" in segment. 
  9. I recommend blocking all traffic from your office IP address in heap under "Excluded IP's"
  10. The Product Manager defines the custom segment user events to track for your app see for inspiration. The Product Manager Adds the implementation of the (frontend/backend) custom segment events to your backlog. 
    1. It is very strongly recommended to implement all the Events from the Segment B2B example if relevant. In this example "Accounts" are basically the company the user belongs to which would pay the bills. CRM systems like Salesforce can use this entity. You can skip this event unless you already have the concept of a Account/Company/"Instance shared with multiple users" inside your app (i.e. "invite a colleague to this instance"). 
    2. Further inspiration: 
  11. Already using cool saas products that integrate as source or destination with segment? Consider enabling them in segment! Segment Tool list (click on destination or source on the top!). Many tools are supported, i.e. stripe payments, crm and helpdesk systems, etc. Warning: Do not implement any tag before reading the related documentation page here, there are many gotcha's!
  12. Your tool is not in the list? Integrate them via zapier! I.e. the intercom event "Conversation" in zapier can trigger a HTTP API call to segment. 
  13. Migrate your Google Analytics and GTM tags into Segment (in case you were not using GTM yet, I recommend starting with that right away). 
    1. Remove your current GA/GTM tags from your frontend code.
    2. Add the GTM Destination in Segment
    3. Inside GTM add your existing GA key.

Recommended Events for B2B SaaS

All from . It is very strongly recommended to implement all the Events from the Segment B2B example if relevant. In this example "Accounts" are basically the company the user belongs to which would pay the bills. CRM systems like Salesforce can use this entity. You can skip this event unless you already have the concept of a Account/Company/"Instance shared with multiple users" inside your app (i.e. "invite a colleague to this instance"). 

Additionally, you want to track when a user places an order or starts a subscription.  I highly recommend using the events your checkout/payment/subscription system API already provides instead of inventing your own.  I.e. for SaaS subscription businesses I highly recommend Chargebee to take care of all subscriptions/payments. Chargebee (i.e. via Zapier) exposes these events: 

  • New Subscription - Triggered when a new subscription is created.
  • New Invoice - Triggered when a new invoice is generated.

  • New Charge - Triggered when a payment is collected successfully.

  • Subscription Change -  Triggered when a subscription is upgraded or downgraded.

  • Subscription Activated - Triggered when a subscription is changed from trial toactivestate.

  • Subscription Cancelled - Triggered when a subscription iscancelled.
  • Failed Charge - Triggered when a customer payment fails.
  • Subscription Reactivated - Triggered when the subscription is moved fromcancelled state toactive or in_trial state.

Onboarding / Engagement Events - Are our users becoming Active?

These are specific to the app, here are some examples. Keep in mind to especially measure those events that create value for the user. You especially want to track those events that cause users to stick around (i.e. for Facebook this was adding at least 10 friends). 

  • Added a Contact/Project/Task/Widget/Page/etc

Also track events that are not caused by the user but still create value for the user, i.e. 

  • Virus Found (virus scanner example)
  • Client Viewed Offer (online proposal software)

Track a few high-level Error types as these are negative value events that could correlate with users leaving or not signing up, unless you already have an error tracking tool feeding these events to Segment. 

  • Server-side Error
  • Form Validation Warning
  • Client-side Error (only serious errors that block normal functionality of a page)

Use a Capital letter for every word to be consistent. Try to keep the total number of events types under 50 as some tools like intercom don't support more. So track generic events and put further details into the event properties. 

Retention Events

  • Signup for notifications (properties: Frequency: Daily/Weekly/etc)
  • Enabled a bot (that somehow engages with the user)

Referral Events

As the box says, events that cause your SaaS to go into a viral spiral of growth, i.e.:

  • Invited another user
  • Referred a friend
  • (publically) Shared an article/report/dashboard/uptimepage/etc 
  • Enabled a bot that share something that other people also can see


What if I want Pageview events (i.e. "Viewed Signup") that I have in HEAP also in other tools ?

Be carefull: If every page would raise a different event (i.e. "Viewed Blog post on chocolate") you'll end up with more events than managable in most  tools (i.e. intercom has a 50 event type limit). However you could implement an event like "Viewed a Landingpage" (with specifics in the properties) in segment. A guide how to quickly/best do this can be found here: . This does require a small code fragment and it won't have date from the past like heap does.  

Further reading

Inspiration on what Backend/custom events to track:

  • No labels