Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show href for <a> tags in breadcrumbs #3011

Closed
Christilut opened this issue Jan 27, 2020 · 4 comments
Closed

Show href for <a> tags in breadcrumbs #3011

Christilut opened this issue Jan 27, 2020 · 4 comments

Comments

@Christilut
Copy link

Summary

The breadcrumb for <a> tags should also show the href contents to more easily identify which <a> was clicked.

Motivation

I have a footer with <a> links but the breadcrumb in Sentry shows something like this: div.flex.flex-wrap > div.column > a#contact. I already added #contact to identify it more easily but it would be nice if the href can be in there so I don't need to identify links manually.

@BYK
Copy link
Member

BYK commented Oct 24, 2020

@kamilogorek @priscilawebdev @HazAT this sounds more like an SDK issue, am I right?

@kamilogorek
Copy link
Contributor

Until we change this in the SDK, it can be achieved with:

Sentry.init({
  beforeBreadcrumb(breadcrumb, hint) {
    if (breadcrumb.category === 'ui.click' && hint.event.target.href) {
      breadcrumb.message += `[href=${hint.event.target.href}]`
    }
    return breadcrumb;
  }
})

@BYK
Copy link
Member

BYK commented Oct 27, 2020

Transferring to sentry-javascript

@BYK BYK transferred this issue from getsentry/sentry Oct 27, 2020
@onurtemizkan
Copy link
Collaborator

Newly added serializeAttributes option of breadcrumbs integration can be used for this functionality.
Ref: #3620, #3755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants