Over a million developers have joined DZone.

Analyze Client-Side Events in New Relic Insights with Browser Instrumentation

· Performance Zone

See Gartner’s latest research on the application performance monitoring landscape and how APM suites are becoming more and more critical to the business, brought to you in partnership with AppDynamics.

[THis article was written by Ankush Rustagi] 

On March 25th, the New Relic Insights team enabled a powerful new feature: Browser Instrumentation. This feature is designed to allow you to instrument and analyze more detailed data originating from your end users, and tag any event in your frontend code with JavaScript to send that event information into New Relic Insights via our JS API. The API is designed so that New Relic Browser users can capture and analyze events, actions, route changes, or basically anything users might do on your site or application. With just a couple lines of code you can instrument your JavaScript application to send custom events—called PageActions—to Insights.

What is Browser Instrumentation and why is it useful?

We added this capability to New Relic Insights to expand the kind of data you can analyze from New Relic Browser. To use this new feature set, you need to have an Insights Pro account, whether on a trial basis or as a paid user. You will also need to have a website or app with New Relic Browser installed. You can install the Browser agent via a New Relic APM agent, or by copying and pasting a code snippet into your HTML.

Why this feature may matter to you:

  • You can’t install the APM agent on your servers due to CDNs, virtualization, etc., but you want to have visibility into user engagement and add custom business information via custom attributes.
  • You want visibility into engagement with features that load data asynchronously or features that don’t cause a page load or server side transaction (video plays and pauses, clicks that open a modal, hover states, etc.).
  • You can’t measure engagement effectively in your single page app (AngularJS, Ember.js, etc.).
  • You want to see the frontend click-level engagement and server-side transactions in a single view.

The release of Browser Instrumentation includes:

  • A new JavaScript snippet that sends data to our JS API based on events you tag in your code with one to two lines of JavaScript. (Note: If you are injecting the Browser JS snippet via your APM agent, you will automatically be using the new JS API, so you just need to tag events in your code. If you applied the snippet stand-alone, you will need to update to the latest version.)
  • A new PageAction event in New Relic Insights for any of your instrumented events, which also has new default attributes, such as referrer URL, current URL, browser width and height, and time since page load.
  • The ability to add custom attributes and events into New Relic Insights via the JavaScript snippet from New Relic Browser.
  • For more detailed information, check out our documentation.
chart displaying New Relic Insights data

click to enlarge

Some interesting use cases from our beta testers

As we have spoken with our customers throughout the beta testing period, we have seen a variety of different use cases as they played around with the new feature. Below are a few sample use cases to understand the various ways in which this feature has expanded analysis capabilities within New Relic Insights.

E-commerce checkout flows

Analyzing steps throughout the checkout process is a common practice for e-commerce companies. But one e-commerce company wants to know how long it takes for its users to complete each specific step, which gets complicated when there are multiple actions that occur on the same page as each user goes through the process. Some questions the team has include:

  • How long is each individual step for the user?
  • How long does it take between landing on a page to filling out the first step?
  • How long until the user clicks “next”?
  • What does the funnel look like from checkout through each individual step, not just each page in the flow?

The company has found the answers to these questions by instrumenting several PageActions on its website to assess checkouts. Now that it can see how long users take to check out, the company has a better understanding of what constitutes a successful conversion, which has allowed it to improve and increase conversion events on the site.

Video engagement at media companies

A digital media company embeds videos on its website, to which it drives user traffic. The company knows that engaged users typically watch at least 50% of a video. Via New Relic Insights PageViews, it can see that users are viewing the videos, but without being able to instrument the embedded video player, it cannot see when the users click pause or when they watch 50% of a video.

By instrumenting those events using the Insights Javascript API, the company is now better able to measure when users are engaged as well as which videos have the most engagement. By establishing and finding patterns in user engagement, it is easier for the company to identify which types of videos it should focus on driving its users to.

Optimizing “learnboarding” at a SaaS company

An SaaS company has an onboarding process (which we call “learnboarding” internally) that all engaged users must complete in order to truly adopt the platform. It can see when users are accessing the learnboarding page on the site, but unfortunately the specific steps within the learnboarding process occur solely in the JavaScript and therefore cannot be identified via server-side instrumentation.

Now the company instruments the learnboarding steps via the Insights JS API, which has allowed it to see which users have successfully completed the process and which haven’t. This has enabled the company to reach out to those users who didn’t finish and proactively ensure that they’ve received the onboarding and training they need to be successful in adopting the SaaS product.

How to get started

As demonstrated in the examples above, Browser Instrumentation can give you a powerful, new way to instrument and collect your data in New Relic Insights. It fills an important and meaningful need of our end users to get more detailed metrics from the client side of their applications.

You will need New Relic Browser installed on an app (even as a Browser Lite user) and New Relic Insights Pro (either trial or paid) to access this feature set. If you are an existing Lite or Paid customer without access to Insights Pro, please contact a sales rep so they can provision you a Pro Trial. For new users, you can initiate an APM Pro Trial and get an Insights Pro Trial as well.

To get started, read through our documentation and follow the instructions for updating your JavaScript snippet and tagging various events in your code.

Happy querying!



The Performance Zone is brought to you in partnership with AppDynamics.  See Gartner’s latest research on the application performance monitoring landscape and how APM suites are becoming more and more critical to the business.

Topics:

Published at DZone with permission of Fredric Paul, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}