Customize your site’s pages in Real User Monitoring with wildcarding

| 3 min. (604 words)

If you haven’t yet seen it, Raygun Real User Monitoring is a modern solution that allows you to drill into your user’s behavior on your site in real time. In [previous blog posts we’ve highlighted how easy it is][2] to integrate RUM into your web site or app. Once you’ve done that, you’ll quickly notice various pages appearing in the Performance tab, which contain crucial performance timing data which give you unprecedented visibility and allow you to optimise you site for the way your users are behaving.

Depending on your site/app’s routing scheme, you may start to notice duplicate pages quite quickly. For example, take a blog site like this one. You may wish to bucket multiple post pages into one, ignoring DateTime segments in the URL, as their content is very similar. RUM provides a set of options and defaults that allow you to specify how your user’s requests are grouped into page buckets, termed the ‘[path segment rules][3]‘. In this blog post I’ll give you an overview of how it works, so you can customize it to your needs.

Out-of-the-box defaults

Integer segments

Many REST URL schemes as encouraged by popular wisdom and server-side frameworks will include integer segments that represent different state, e.g user IDs. An implementation of the routes to view two user’s profiles could look like this:


/user/5678/profile```

Out of the box, Real User Monitoring will wildcard the second segement as it is an integer only (no alphabet characters). The result of the automatic wildcarding will end up with the following page in RUM:

```/user/*/profile```

Thus, views to anyone’s profile will be bucketed together, and you can compare the performance timing metrics in aggregate and make a decision on whether to optimise. This is useful if the segment is variable and represents different model from one controller action triggering one set of queries, which gets applied to one view.

### WordPress timestamp segments

If you click on the link in the title of this post, you’ll see a route containing the following:

```/blog/2015/10/...```

As WordPress blogs are so common, RUM will wildcard these automatically for you. The /2015/ and /10/ segments will be wildcarded, resulting in one page in Real User Monitoring for all blog posts:

```/blog/*/*/...```

## Grouping

Grouping is the term for applying the above wildcard to any segment of your choosing, even if it is not an integer or WordPress timestamp. You do this by providing a list of paths containing wildcards at the appropriate place. Incoming requests that match those rules will have their segments replaced in the same way as above. For instance, say you have base 16-encoded segments representing a user:

```/user/ff0124ff/profile```

To replace the middle segment with a wildcard, you can add the following to the grouping rules (under Application Settings):

```/user/*/profile```

## Ungrouping

Ungrouping is the opposite of the above two behaviors, naturally. It allows you to prevent wildcarding. Say you actually want two user profiles to appear as two pages in RUM, you can add the following to your group:

```/user/1/profile
/user/2/profile```

Only those two will then be split out. You can add as many as you like. Note that setting changes to any of the path segment rules may take up to 15 minutes to appear in RUM.

## Get started with Real User Monitoring now

If you haven’t yet got a Raygun account you can [start your free 14-day trial here][4], no credit card needed. Otherwise log in and check out Real User Monitoring and the Application Settings to configure these rules, and start discovering exactly how your site behaves!

 [1]: https://raygun.com/platform/real-user-monitoring
 [2]: https://raygun.com/blog/adding-real-user-monitoring-to-your-site-with-raygun/
 [3]: https://raygun.com/documentation/product-guides/path-segment-rules/
 [4]: https://app.raygun.com/signup