How to get powerful user data with Real User Monitoring

Callum GavinReal User MonitoringLeave a Comment

One of the key aspects of a great Real User Monitoring solution is, perhaps unsurprisingly, great user data. When this is available, you can see your customer’s true experiences in real time as they navigate your website or app, alongside the list of errors they’ve had and most crucially, their contact details. If a valuable customer has a bad experience, you can reach out and let them know you’re working on it immediately. It’s also invaluable for helping with the triage of vague customer support tickets by tracing the sequence of page loads during a user session, allowing you to construct a precise picture of what happened.

If you haven’t already seen how to get started with Real User Monitoring, or RUM, check this introductory blog post first.

In this blog post, I’ll show how easy it is to get great user data into your RUM dashboard, as well as some examples for popular templating DSLs. Let’s crack into it.

Basic implementation

This is what the resulting JS script should contain once you’ve provided your user data, as it would appear in the static HTML file requested from the server:

If you wish to record an anonymous user, for instance on your login page pre-authentication, you should set isAnonymous to true and optionally provide an identifier (we’ll assign a random UUID if none one isn’t set).

Naturally, you won’t want to hard-core those values, so let’s get the above snippet data-driven using some popular serverside frameworks. You want to paste these snippets into an appropriate view that is common to all the pages you want to see in Real User Monitoring. For instance, in MVC frameworks like ASP.NET MVC and Ruby on Rails, you might want to place it in a shared main layout view file, or a partial that includes only the Raygun4JS configuration.

Razor (ASP.NET MVC 3+)

Inside a .cshtml view, assuming there is a ViewModel with the following property names attached:

.ASPX in WebForms and MVC 1/2

.ERB in Rails

Assuming that the user data is available on a ‘user’ instance variable, populated from current_user and the DB:


As sometimes used in Node.JS frameworks like Express, Koa et la, and also applies of course to Mustache templates also:

Get started with Real User Monitoring now

As you can see, they’re all pretty minimal! There are a million view engines out there so if this post has missed your favorite hopefully you can get the gist from the above examples. If you haven’t yet got your free Real User Monitoring trial, you can start here – free for 14-days and no credit card required. Any questions let us know in the comments below!

** UPDATE **

Real User Monitoring for Mobile Applications is here! See the update here.

Next level software intelligence across your entire stack.

Leave a Reply

Your email address will not be published. Required fields are marked *