When our script initally executes (loads) it will attach a global logging object to the window object. This global object is called justlogit.
This is the list of methods on the logging interface you can call to store values from your running web application.
|logPerformance||Logs a performance record. Performance is calculated by taking the start and end timestamps (Date objects) and getting the millisecond difference between them.|
|logEvent||Logs an event occurrence for the application.|
|logError||Logs the details of an error. The error object is expected to have the default error object properties (message and stack)|
|logInformation||Logs an information record. These information entries are useful to provide extra context around things like errors.|
|enableUserTracking||n/a||Enables user tracking which will allow you to correlate logged items to specific users. By default user tracking is disabled. Details on how user tracking works is in a following section.|
|setUserMarker||Allows you to set the specific user marker you want to use to correlate any actions to a specific user. This can be a user identifier from your system or any other type of value you want to use. When you set this value it turns on User Tracking at the same time.|
|doNotTrack||To support newer privacy laws we have put in a Do Not Track setting for the justlog.it script library. When DNT is enabled we store less information about the connecting user to maintain their privacy.|
One of the things that sets our logging system apart is we have designed our system with user correlation as a first-class citizen. In order to effectively troubleshoot issues and hunt down performance issues knowing which user(s) are being affected is incredibly helpful.
However we do not enable this type of tracking by default. The main reason for this is to allow our customers to more easily comply with some stringent privacy regulations such as the GDPR regulation which imposes substantial penalties for non-compliance. In addition, we don't know automatically the best way to identify your users so need you to provide us with that identifier.
To enable user tracking you call either the enableUserTracking or setUserMarker methods on the logging library. Either of these will enable user tracking and add the user properties to the submissions, which is why that is not a parameter in the logging method calls.
A very common thing you might want to do is log the load times for your web pages. Slow web pages are definitely the bane of web users and something that has been proven to directly, negatively, impact revenue on sites due to users leaving.
That said you can get a decent level of accuracy by following these steps:
That call will log the performance of the page load, at least up to the point where the DOM is ready, so all initial resource calls have completed. In addition we will automatically capture values such as the user agent so you can see which browser this applies to and the location of the request so you can correlate slower performance with location if necessary.