Add Real User Monitoring to your site with Pulse

| 3 min. (468 words)

You might have seen our recent announcements about Raygun real user monitoring, the second offering from Raygun alongside the existing Crash Reporting service. Pulse is a ‘real user monitoring’ solution that allows you to discover, monitor and pinpoint your actual user’s behavior and experience as they browse and use your web site/application. The key advantage is that it gives you performance metrics for every user in real time, allowing you to see where their experience is poor and what areas to focus on to delight them.

Integrating Pulse into your website is friction-free, and if you’re currently using Crash Reporting you only have to upgrade Raygun javascript error reporting and it’ll even work out of the box! If you’re new to Raygun the process is just as easy and should take about as long as a coffee break. Here’s how:

Step 1: Add the snippet

Paste in this JS snippet to your HTML, above the closing tag:

<script type="text/javascript">
  !function(e,n,t,r,o,s,c,a){e.RaygunObject=o,e[o]=e[o]||function(){(e[o].o=e[o].o||
  []).push(arguments)},s=n.createElement(t),c=n.getElementsByTagName(t)[0],s.async=1,
  s.src=r,c.parentNode.insertBefore(s,c),a=e.onerror,e.onerror=function(n,t,r,s,c)
  {a&&a(n,t,r,s,c),e[o].q=e[o].q||[],e[o].q.push({e:c})}}(window,document,"script",
  "//cdn.raygun.com/raygun4js/raygun.min.js","rg4js");
</script>

This will asynchronously download the Raygun4JS library (not blocking the page load), and also includes the Crash Reporting error handler. There’s also a vanilla one if you don’t plan to use Crash Reporting (the Raygun webapp will auto-generate setup instructions for you based on which ones you want once you log in and create a new application).

Step 2: Configure the library

Next, provide the library with your API key, and turn on Pulse:

<script type="text/javascript">
  rg4js('apiKey', 'your_api_key_goes_here');
  rg4js('enablePulse', true);
</script>

The API key is created inside the Raygun webapp and represents one web site or application. That will again auto-create the above script for you complete with your key, so be sure to log in and let the app do the work for you!

Step 3: Add user data

You can then configure the library with the currently logged in user. You’d populate these values using your templating library to interpolate the data (whether clientside or serverside doesn’t matter).

<script type="text/javascript">
rg4js('setUser', {
  identifier: 'users_email_address_or_unique_id@domain.com',
  isAnonymous: false,
  email: 'users_email_address@domain.com',
  firstName: 'Firstname',
  fullName: 'Firstname Lastname'
});
</script>

Ready to go

That’s it! The first snippet will then download the provider, and when it’s ready it’ll begin sending timing data using the information you’ve provided as detailed above. Request and session data will then appear in the Pulse dashboard, allowing you to begin seeing how your site performs across the world.

To get started, either log in and create a new application with Pulse enabled in the wizard, or start your free Raygun trial here. You can select free 30-day trials of one or both of Pulse or Crash Reporting – no credit card needed. Let us know in the comments below if you have any questions about this!

** UPDATE **

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