Skip to main content

RUM Snippet API

You can configure DebugBear Real user monitoring (RUM) directly from the DebugBear dashboard. However, you can also control the behavior of the snippet with code on your website.

When to call the DebugBear RUM code

You can run call the DebugBear RUM API code from anywhere on the page as long as the dbbRum global is first initialized like this:

// Initialize the dbbRum array in case the DebugBear script hasn't loaded yet
window.dbbRum = window.dbbRum || [];
// Call the DebugBear RUM API or queue an API call
window.dbbRum.push(["API_CAll", "PARAMETER])

Controlling the sampling rate

You can set the page view sampling rate via the dashboard or configure it on the page like this:

<script>
window.dbbRum = window.dbbRum || [];
//Track 20% of page views
window.dbbRum.push(["sampling", 20]);
</script>

Tagging page views

You can tag page views using the tag1, tag2, and tag3 API actions. Each tag takes a string parameter as its value.

<script>
window.dbbRum = window.dbbRum || [];
// Your custom logic to decide what tag value to set
const tag1Value = userIsLoggedIn ? "LoggedIn" : "LoggedOut";
window.dbbRum.push(["tag1", tag1Value]);
window.dbbRum.push(["tag2", "UserType_Editor"]);
</script>

Tags then show up as part of the individual page view details:

Page view with tags

You can also view breakdowns by tag or filter for a specific tag value.

Login state filter

info

You currently can only add up to three tags. We recognize the tagging functionality is a bit limiting, but it ensures all the usual breakdown and reporting functionality is also available for tags.