There are lots of tools that provide Error tracking and we would like to implement a basic, yet useful, alternative as part of Piwik Data Analytics platform!
In 588e68948a3b68223ceecc7a2575db4a220be8c4: refs #4977 added a new method to the tracker to enableJSErrorTracking. This is beta... feedback is welcome...
In 128d75a58139168f77089be7e68fd5818e6b8d59: refs #4977 enable JS error tracking in Piwik UI (if tracking in Piwik UI is activated)
In 5ef610b382d6717e388a8e4a5cc3e8e9ba82cba1: refs #4977 include piwik tracker as early as possible to make sure we track js errors
In 5d74768e6c20b564101e0212eeb4d5b21fbe0a6d: refs #4977 make JSLint happy
Replying to Thomas Steur:
include piwik tracker as early as possible to make sure we track js errors
makes sense, but may result in problems if users use tools to protect their privacy (like extension "ghostery" in FF ) which blocks piwik.
If Piwik script is blocked sometimes the complete site is not usable any more because the following js is blocked/broken too..
In 0f43631624d1bbb37f49c2fadebe8d5dfed24e9a: refs #4977 make clear that only uncaught errors are tracked
Is it a working feature or a planned one?
If you're planning, please consider stealing code from https://github.com/MindscapeHQ/raygun4js (AJAX error, stack trace etc.)
https://github.com/getsentry/raven-js is also using https://github.com/csnover/TraceKit
But there is https://github.com/stacktracejs/stacktrace.js also.
It is working in general but only very basic. We simply track all errors as events for now but hope to provide similar enhanced features some day than others do
"it is working in general but only very basic"
is there any doc how to use it? Do one has to enable it or should it work without any config directly "out of box"?
Looks like there is no documentation for it indeed. There's a bit of documentation here: https://github.com/piwik/piwik/blob/2.16.0/js/piwik.js#L5869-L5886 and to activate it you can call
It is very very basic though and I would suggest to first give it a try as it will add many different event actions and event names to your event reports in case you are using them for something else currently (it could give you a less good overview of action and names in event reports)
_paq.push(['enableJSErrorTracking']); after i add this sentence in my website, i want to know where i can check the result in my piwik. thanks!
You can see some basic reporting in the "Actions => Event" reports
this is my test website which i track it with piwik, and there is an error. I have added _paq.push(['enableJSErrorTracking']) in the tracking code.
i want to track the error, but it shows nothing in piwik
do you know why?
thanks a lot if you can help me
this is my website
Maybe Piwik is loaded after the error occurred.
The thing is Piwik is loaded async by default so it might still not capture all errors unless you loaded it sync which is not recommended.
thank a lot for telling me about this, do you know how to loaded it sync? i want to have it a try to test this function. And do you know where can we find some demos to show the errors being tracked? i have a job to use piwik proficiently
i define many errors in my website, but i cannot find any one in the piwik action->event, which confuses me. Which type of error does the piwik track?
i want to know when i enablejserrortracking function, which table will store the data from website in piwik? Can you help me? thanks!
If you navigate the website containing errors, could you check, using development tools, if you see any requests to your Piwik server?
thanks for your reply @RMastop
there are responses to piwik, but it did not carry error message. Can you give me some advice?
@wei1215583760 When should the js error occur? Could you post the HTML of the page?
this is my website code, index.html. And i add an error
t>, ths whole
@RMastop do you know where i the error message it stores as log data?
@wei1215583760 I tried to reproduce the issue, but no call is triggered after the JS error. Without the call to the piwik server, no need to search for it in the database.
thanks a lot for your patience, but i still do not know how to track the error, maybe this error can not be tracked? do you know what kind of error can be tracked?
Now i want to make sure that this function can track errors and show it with piwik dashboard. if you have some examples, can you give me example errors?@RMastop
As documented, Could you put the Piwik tracking code all the way to the top op the HTML, just below
e_n:Uncaught ReferenceError: a is not defined
do you mean put the tracking code like this ? but it still have no reponse ...sad
where do you get your message? in action=>event?
You can also try running the tracking script non async/deferred as explained here: https://developer.piwik.org/guides/ab-tests/browser
This will slow down your site a bit but will make sure that piwik is loaded before the error occurs.
maybe now that we have a documentation on how to run piwik non-asynchronous, we should maybe we should also document this feature. (And warn about the performance decline)
Yes, but asynchronous method did not work for error tracking in my case. Maybe this case will be a good guide for other users
If i want to make sure where the error happened, i need to know the accurate message
@tsteur do you know how to track full trace back using js? If there are some errors, I want to find it more easily with trace back information.
Currently piwik doesn't add the stacktrace, but it shouldn't be that hard to add:
At least in chrome (I am not sure about other browsers) the stacktrace should be accessable via
Do you know where these error strings are stored?
They're stored as Actions in log_link_visit_action and log_action tables see: https://developer.piwik.org/guides/persistence-and-the-mysql-backend#action-types