Recording the context of a user session

When recording user sessions with Meticulous, you can add contextual information. This can make the sessions easier to find, and can help your developers debug diffs in these sessions more easily.

Adding context to user sessions

Meticulous provides several methods to record different types of context. If you record the same piece of context multiple times, the last value will be used.

Recording user information

You can record the ID and email address of the logged-in user:

// Record the ID of the logged-in user
window.Meticulous?.context.recordUserId('user-123');

// Record the email address of the logged-in user
window.Meticulous?.context.recordUserEmail('user@example.com');

This information is associated with the session and makes it easier to find sessions for specific users.

Recording feature flags

You can record which feature flags were active during a session (the value should be a string or boolean):

window.Meticulous?.context.recordFeatureFlag('bigUiRefactor', true);
window.Meticulous?.context.recordFeatureFlag('checkoutFlowStyle', 'v3');

You can either record flags one by one as they are used, or loop over all the flags at app initialization.

To learn how Meticulous tests these recorded feature flags, see Testing Feature Flags with Meticulous.

Recording custom context

For any other contextual information that doesn't fit into the categories above, you can use the custom context method (again with a string or boolean value):

window.Meticulous?.context.recordCustomContext('userRole', 'admin');