Javascript grouping for errors across user profile pages

Hi All,

I’m running a website which has URLs like:
https://domain.com/USERID-USERNAME

This page triggers errors when JS resources do not load properly, however these errors are grouped per page which means I have the same error repeated for every user affected.

Is it possible to set a Page Alias or similar so sentry groups all these errors under a more generic “profile page” rather than “profile for user X”?

Thanks all!

Michael

You can use setFingerprint as described in this blogpost: https://blog.sentry.io/2019/01/17/debug-tough-front-end-errors-sentry-clues

Sentry.withScope(scope => {
  scope.setFingerprint(['https://domain.com/USERID']);
  Sentry.captureException(error);
});

If you want to group all issues together globally on this specific site you can use:

Sentry.configureScope(scope => {
  scope.setFingerprint(['https://domain.com/USERID']);
});

that means that all errors that occur afterward will have this fingerprint so be aware of that.

The fingerprint itself tells sentry how to group errors.

Hope this helps.

1 Like

Thank you very much for the information about fingerprints, I will give it a try and report back. :slight_smile:

This works really well, thanks for your help. Here’s the code I’m using in production when pages supply a fingerprint:

Sentry.configureScope(scope => {
    scope.setFingerprint(<?= json_encode([$fullUrl . '/' . $fingerprint]) ?>);
});
1 Like