def js(options = {})
      options = { reset: false }.merge(options)

      buffer = queue.map { |item| %(_kmq.push(#{item.to_json});) }

      queue.clear if options[:reset]

      <<-JAVASCRIPT
      <script type="text/javascript">
      var _kmq = _kmq || [];
      #{api_js}
      #{buffer.join("\n")}
      </script>
      JAVASCRIPT
    end
def js(options = {})
      options = { reset: false }.merge(options)

      buffer = queue.map { |item| %(_kmq.push(#{item.to_json});) }

      queue.clear if options[:reset]

      <<-JAVASCRIPT
      <script type="text/javascript">
      var _kmq = _kmq || [];
      #{api_js}
      #{buffer.join("\n")}
      </script>
      JAVASCRIPT
    end
In most situations you want the #js! method instead of this one.

 Returns the JavaScript needed to send the current state to KISSmetrics.
 This includes the a JavaScript tag that loads the API code (or a fake API
 that sends events to the console or a global array if the `output_strategy`
 parameter to #initialize is :console_log or :array), as well as statements
 that push the current state onto the `_kmq` array.

 You can pass the option `:reset` to reset the state, this makes sure that
 subsequent calls to #js will not send events that have already been sent.