Send /wsapi/stage_* events to the KPI backend.

* Add tests in tests/kpi-test.js to ensure both staging and completion events are added to the queue.

fixes #3920