Sha256: c309ece9a7d4baaa0a8637fc705f02baaa5da618b33b543152767a1b8f7130cc

Contents?: true

Size: 1.22 KB

Versions: 11

Compression:

Stored size: 1.22 KB

Contents

// DO NOT USE the @view instance variable in any files in /app/javascripts/base.
// The way they are cached makes it not safe to do so.

var Reporter;

// Reports pageviews to OIB for tracking counts of each pageview.
//
// The main interface to this class is located in "header.js" where it can
// make use of the current view name.
//
// == Usage
//
//   Reporter.reportCurrentView(guid);
//
Reporter = {
  error: function(guid, params) {
    // Debug.log("Reporter.error", params);
    Reporter.report(guid, "error", params);
  },
  
  reportCurrentView: function(guid) {
    Reporter.report(guid, View.name);
  },
  
  // Report the Ymail guid and page view name to OIB.
  //
  report: function(guid, view, params) {
    params = params || {};
    
    params["ymail_guid"] = guid;
    params["view"] = view;
    
    // Debug.log("Reporting guid " + guid + ", view " + view);
    Reporter.post(params);
  },
  
  // Post data back to OIB, to the URL /ymdp/report.
  //
  post: function(params) {
    params = params || {};
    OIB.post("ymdp/report", params, function(response) {
      // Debug.log("Reported page view", params);
    }, function(response) {
      // Debug.error("Error reporting page view with params", response);
    });
  },
};

Version data entries

11 entries across 6 versions & 1 rubygems

Version Path
ymdp-0.7.4 lib/ymdp/javascripts/prototype/reporter.js
ymdp-0.7.4 lib/ymdp/javascripts/jquery/reporter.js
ymdp-0.7.3 lib/ymdp/javascripts/jquery/reporter.js
ymdp-0.7.3 lib/ymdp/javascripts/prototype/reporter.js
ymdp-0.7.2 lib/ymdp/javascripts/jquery/reporter.js
ymdp-0.7.2 lib/ymdp/javascripts/prototype/reporter.js
ymdp-0.7.1 lib/ymdp/javascripts/prototype/reporter.js
ymdp-0.7.1 lib/ymdp/javascripts/jquery/reporter.js
ymdp-0.7.0 lib/ymdp/javascripts/jquery/reporter.js
ymdp-0.7.0 lib/ymdp/javascripts/prototype/reporter.js
ymdp-0.6.0 lib/ymdp/javascripts/reporter.js