Event Bus

If you want to hook in custom analytics to the widget or make other elements on your page react to events inside the widget you can do this easily using the event API.

Installation

Include the following code in the header of your site:

    <script>
      (function(i,a) { i[a] = i[a]||{ _upa:[] }; i[a].on = function(e,v) { i[a]._upa.push([e,v]); }; })(window, 'allocate');
    </script>

Tracking Events

You can now add event listeners that will be triggered automatically when certain actions are performed inside the widget.

  allocate.on('start', function(ev) {
    console.log("booking started!", ev);
  s});

  allocate.on('finish', function(ev) {
    console.log("booking complete cost was ", ev.total_cost);
  s});

Last updated