About Views¶
The RUM Browser SDK automatically generates a view event when a user accesses a new page or when the page URL changes (such as in a single-page application). The view name is calculated based on the current page URL.
In certain scenarios, you can also customize view events, including modifying the default name of the view.
You can manually track view events by enabling the trackViewsManually
option, thereby assigning a custom name to the view.
// Enable manual view tracking
window.DATAFLUX_RUM &&
window.DATAFLUX_RUM.init({
trackViewsManually: true,
// ...other configurations
})
// Manually track a view and specify the name and service
window.DATAFLUX_RUM && w
indow.DATAFLUX_RUM.startView({
name: 'custom view',
})
Notes¶
- When initializing the RUM Browser SDK, set trackViewsManually to true.
<script
src="https://static.truewatch.com/browser-sdk/v3/dataflux-rum.js"
type="text/javascript"
></script>
<script>
window.DATAFLUX_RUM && window.DATAFLUX_RUM.init({
trackViewsManually: true,
// ...other configurations
});
-
You must manually start a view every time a new page loads or the route changes (in a single-page application). RUM data is collected when the view starts.
Note
By default, the View Name is automatically generated based on the URL.
<script
src="https://static.truewatch.com/browser-sdk/v3/dataflux-rum.js"
type="text/javascript"
></script>
<script>
window.DATAFLUX_RUM && window.DATAFLUX_RUM.startView();
If you need to customize the View Name, you can specify it manually: