Code to use

How to install

Easy and clean

1. Create a JSLogger account.

2. Include the script in your web page, preferably before any other script:

<script type="text/javascript" src="//"></script>
<script type="text/javascript">window.jslogger = new JSLogger();</script>

3. Start monitoring errors

CDN support (recommended)

The JSLogger tracker can be loaded from CDN. The advantage is that the script will be delivered much faster around the world.

Unfortunatelly, we don't support a CDN version for HTTPS but, don't worry, the script will be delivered directly from our server for your secure connection.

<script type="text/javascript">
document.write('<script type="text/javascript" src="' + ('https:'==document.location.protocol?'https://':'http://c.') + '"><\/script>');
<script type="text/javascript">window.jslogger = new JSLogger();</script>

Dynamic loading

You can load JSLogger dynamically in your page. The only downside is that a couple of logs can be missed while the script wasn't loaded yet.

<script type="text/javascript">
(function () {
var jsl=document.createElement('script');jsl.type='text/javascript';jsl.async=true;
jsl.onload=function(){jslogger=new JSLogger();};
var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(jsl,s);

How to track?

All Javascript errors in your site will be logged to our server by default. But you can also log and track events on your own.


To log errors or other types of notifications use the .log(data) function

jslogger.log("I am an exception")
jslogger.log({exception: {name: "SignupFail", message: "The signup request failed."}})


To log special events use the .event(data) function

jslogger.event("The signup button was clicked.")
jslogger.event({signup: {from: "Header red button"}})


Log an Ajax request error with jQuery:

  url: "/signup",
  success: function () {
    jslogger.event({signup: {from: "Header red button"}});
  error: function (jqXHR, textStatus, errorThrown) {
    jslogger.log({signup_error: {from: "Header red button", xhr: jqXHR, status: textStatus, error: errorThrown}});

Track mouse events:

$("#payment-button").mouseover(function () {
  jslogger.event("The client found the payment button...");

$("#payment-button").click(function () {
  jslogger.event("The client payed!");

Track window events:

$(window).scroll(function () {
  jslogger.event("The client scrolled your page for " + $(window).scrollTop() + " px.");

Easy integration with the jQueryUI widgets:

  modal: true,
  buttons: {
    "Delete item": function() {
      jslogger.event("Item deleted!");
    Cancel: function() {
      jslogger.event("Item was not deleted.");


If you don't want to send logs to the server in development mode, set track option to false :

JSLogger({track: false});

If you don't want to track the errors in your site, set logWindowErrors to false :

JSLogger({logWindowErrors: false});

All your logs are authorized by the domain they come from. Each project has a unique domain name assigned to it. You can use your API key when sending logs from a desktop app or one hosted on your local machine. The key will ignore the domain referal.

JSLogger({apiKey: "YOUR_PROJECT_API_KEY"});


Questions, bug reports or feedback?

Please send an e-mail to

For a quick response you can always ping us on Twitter - @jslogger or tweet about how awesome JSLogger is - #jslogger.

Like us on Facebook and become a part of the JSLogger community.

Track issues on GitHub.