View tracking
Note
The view tracking instrumentation is available as of Grafana Faro Web SDK version 1.0.0-beta6.
The view tracking instrumentation reports the change of the view meta as an event. This is useful for RUM because you can track when a new view is set.
For example, you can set the following different views for an application:
- The register and login pages can be considered
authviews - The homepage page can be considered a
homeview - The users listing and user profile pages can be seen as
usersviews
Using the view tracking instrumentation, you can correlate errors, logs, and events that occurred for a particular user when using a particular section of the application.
In order for the view tracking instrumentation to work correctly, the view meta should be set accordingly.
How to use the view tracking instrumentation
The following view tracking instrumentation is enabled by default. No additional configuration is required.
initializeFaro({
url: 'https://my-domain.my-tld/collect/{app-key}',
app: {
name: 'my-app',
},
});Note
If you overwrite the
instrumentationsarray when you initialize the Grafana Faro Web SDK, you must manually include the View tracking instrumentation.
To manually include the view instrumentation, use the following getWebInstrumentations helper function.
initializeFaro({
url: 'https://my-domain.my-tld/collect/{app-key}',
app: {
name: 'my-app',
},
instrumentations: [...getWebInstrumentations()],
});Alternatively, if you want to fine-tune which instruments are enabled, you can use the following ViewInstrumentation class.
initializeFaro({
url: 'https://my-domain.my-tld/collect/{app-key}',
app: {
name: 'my-app',
},
instrumentations: [new ViewInstrumentation()],
});


