Google Analytics: Tracking logins

Software as a Service (SaaS) companies often place a link to the login in the top navigation of the marketing site. Both current customers and visitors to the marketing site come to the site and the two populations get mixed together in the Google Analytics reports. This can make it very difficult to analyze your data.

In this post, I’ll talk about why being able to separate these two audience groups matters and how to separate them in Google Analytics.

Why it matters

When current customers are mixed with visitors to the marketing site, it can cause problems when you analyze the data. For instance:

  • An important metric on marketing sites is the eCommerce conversion rate, i.e. the number of conversions divided by the number of sessions. It’s a useful metric when taken in context with other site data as it points to the effectiveness of a site. If a lot of people are coming to the marketing site to login, then it artificially lowers the eCommerce conversion rate. This is unfortunate as it makes the metric unusable.
  • On the flip side, if you don’t have a way to isolate the sessions that include a login, then it can be difficult to analyze the Google Analytics reports. Even a simple question like ‘How many sessions to the site included a login?’ can be very hard to answer.
  • In some cases it can also be useful to segment out how the users who are currently customers and logged in interact with the marketing site – this is especially true if the product includes upsells that direct customers to the marketing site.

By segmenting out the users who login, you get a better handle on how different audiences interact with your site.

Custom dimensions

Custom dimensions add non-standard data to your Google Analytics reports (see the earlier post on determining the data set for background on how Google Analytics is structured).

A custom dimension is set at the property level. To set up a custom dimension, go to the admin section, in the property column click on Custom Definitions, and then select Custom Dimensions.

Unless you’re a premium user, you can only add 20 custom dimensions. When you set up the custom dimension it will ask you for name, scope and whether it should be active or not. How you set up the custom dimension will depend on your specific needs.

For instance, setting the scope to user sets the custom dimension at the user level. Even if the user does not log in on future visits, they will still be grouped into the custom dimension. This makes sense if you’re looking at binary situation where someone is either a customer or not a customer.

On the other hand, if you set the scope to session, then the custom dimension only lasts as long as the session does. If the user ends the session and then comes back, the second session will not be captured in the custom dimension. This might make sense if your users move fluidly between customer and prospect.

In order to track custom dimension, the developer will need to make changes to the code to capture the action you are interested in.

You can construct filters using custom dimensions. This is extremely powerful. You could set up a view that includes only logins by filtering on a custom dimension that tracks logins. You could use the same idea, but with an exclude filter, to remove all the logins and just view the visitors to the marketing site.

Using custom dimension to track logins is an elegant solution, and it’s embeds the data in the reports. For more details on how to set up custom dimensions, see this Google Analytics article.

Segments

In some cases, you won’t be able to use custom dimensions to track logins. There are only 20 custom dimensions available (unless you’re a premium customer) and perhaps they’ve been used for something else. Or perhaps you can’t get the resources to make the code changes that are necessary. Or maybe you can move forward with a custom dimension but you need to look at historical data. If you find yourself in a situation where you can’t employ custom dimensions, you may need to work with data at the report level using segments.

The exact set up of the segments will vary depending on the site, but the idea is to use the URL structure to segment by user. (If you’re not familiar with how to build a segment, check out this Google Analytics help doc.)

For instance, suppose your marketing site is on these three pages:

  • www.example.com/features
  • www.example.com/pricing
  • www.example.com/signup

The pages for customers behind the sign in are:

  • www.example.com/dashboard
  • www.example.com/app
  • www.example.com/stats

In this case you can set up a segment that filters using the dimension Page so you only include users who have visited /dashboard or /app or /stats, i.e. users who must be logged in because these pages can only be visited when someone is logged in. An exclude filter on the same lines would remove people who have logged in.

There are some downsides to this method, however.

Adding segments manipulates data that has already been passed into the report. Over long time periods or with large data sets, Google Analytics often uses sampled data when a segment is applied. Sampled data can, in some cases, be quite inaccurate.

These segments are also fairly difficult to get right. For instance, you have to capture every path in case someone has bookmarked a link directly into the app. Likewise, the URL structures that a user accesses when they log in has to be unique from the URL structure that exists for non-logged in users. For instance, if the marketing site and the application share a path in places, you may not be able to distinguish between the two audience groups. You also have to update the segment regularly if the URLs change, and this can be difficult to stay on top of.

Upshot

Custom dimensions are the better choice for separating logins from other audience groups visiting your marketing site. However, in some cases you will have to work with the data once it’s already been passed into the reports. When that is the case, segments can be a very powerful tool.