/*!
 * Client script for Trek analytics.
 */

var Trek = {};

(function ($) {
  /**
   * Track multiple events.
   */
  Trek.trackEvents = function (events, callback) {
    if (Trek.serverURL) {
      $.ajax({
        cache: false,
        contentType: "application/json",
        data: JSON.stringify(events),
        dataType: "json",
        processData: false,
        success: function (data, textStatus, jqXHR) {
          if (callback) { callback(data); }
        },
        type: "POST",
        url: Trek.serverURL + "event/"
      });
    }
  };
})(jQuery);


