How to debug code which uses the JavaScript API?


The only way I could figure up to now is to make it by trial and errors:
using activity log or Reports, etc but:

  1. This will probably be very long and painful (inaccurate way to debug) as updated data can be long to process.
    So you change something, and see the effect (or not) the next day, or a few hours later if lucky.
  2. Some features can be complex to test, such as _hsq.push([“identify”, { {identity details} }]);
    In such case, at first, seeing that this push was fired and what were the parameters would be enough.

Any developper tool that can be used for that?
Am I too picky: then how do people debug their calls to the “JavaScript API”?

Many thanks.

P.S. Ideally I am looking for the equivalent of : for google analytics
But any help will be appreciated