Reputation: 3734
TrackJS detects errors occurred in all JavaScript code on the page — be it inline code, scripts linked from the same domain or other domain names.
Most of the JS code linked from other domain names (such as various marketing tags, trackers etc.) is not under control of the webmaster; the errors in it rarely impact the user experience and mostly just create noise in TrackJS reporting.
How to exclude foreign-domain scripts from TrackJS reporting?
Upvotes: 2
Views: 462
Reputation: 630
You can do this with either a client-side or server-side Ignore Rule. The server side is a bit easier to get started, but it's a little limited today. You can only build "exclude" rules, which means you'd have to add a rule for each third-party you'd like to ignore.
For example, if you wanted to ignore errors from example.com, you would do this:
We are currently working on some new capabilities for Ignore that will allow you to build "include only" style rules, but that is a little ways out yet.
Maybe a better option would be to write an onError
callback, where you can add your own logic. You could check the error payload to see if it is from something other than what you expect, and only send that. For example:
TrackJS.install({
token: 'your token',
/* other options */
onError: function(payload) {
// some errors don't have a stack, so we only want to exclude the ones
// that do, but are not from our code
if (payload.stack && payload.stack.indexOf('mydomain.com') < 0) {
return false;
}
return true;
}
});
** I'm a developer at TrackJS
Upvotes: 2