Skip to content

Latest commit

 

History

History
65 lines (39 loc) · 3.28 KB

README.mdown

File metadata and controls

65 lines (39 loc) · 3.28 KB

Perfherder 0.2

Perfherder tracks errors and runs performance evaluations using GA events. See index.html for installation and examples.

Why would I use it?

Aggregating site-wide data is is a good way to spot trouble areas like slow pages, slow features, or rare browser-specific errors. Google Analytics is a natural choice for tracking JS issues, as it provides free data collection and powerful tools for viewing and understanding your data.

What will I see in Google Analytics?

Perfherder tracks events under Perf By URI, Perf By Browser, Error By Type, Error By Browser, and Window Size.

Each event is logged once in both of its categories, which allows you to to narrow down issues on particular pages or in certain browsers.

For perf, Perfherder tracks:

  • URI
  • Simplified user agent
  • Custom tracking name (eg: "Slideshow Setup Time")
  • Milliseconds elapsed since pageload or a custom point

GA will also provide average values for the milliseconds.

For errors, Perfherder tracks:

  • Error message
  • Simplified user agent
  • URI (and JS filename, if available)
  • Line number (if available)

Perfherder also records your visitors' actual window sizes.

How do I use it?

Instantiate with var _prf = new Perfherder();

  • _prf_start: Start-time var, must be set to new Date().getTime() in the <head>
  • _prf.mark(mark_name): Mark a particular time to track against later.
  • _prf.record(name): Track the elapsed time since pageload, using the action name [name]
  • _prf.record(name, mark_name): Track the elapsed time since mark_name was marked.
  • _prf.error(error): Track an error returned by a catch statement.
  • _prf.window(): Track window width and height as separate values. Great for getting average sizes of actual windows (as opposed to GA's default screen size).

How do I change the settings?

Just instantiate a little differently: var _prf = new Perfherder({ setting_name : value });

  • track_errors: Enable/disable automatic error tracking.
  • track_window: Enable/disable automatic window dimension logging.
  • debug: Enable/disable logging
  • sample_rate: (Defaults to 1) If you set this to 0.1, Perfherder will randomly send only 10% of the data it collects to GA. This is a good way to cut down on GA events on a very highly-trafficked site.

I don't like IE, do I still have to browser test?

Nah.

Will this interfere with my existing site tracking?

"For each visit (user session), a maximum of approximately 500 combined GATC requests (both events and page views) can be tracked." - GA docs

Perfherder calls track between 1 and 3 events each. It is possible to track so many events that you hit GA's limit and can no longer receive valuable information about a user. This is especially dangerous in an eCommerce situation, where a user's final actions are the most valuable.

If you're afraid of Perfherder flooding your data or blowing a user's request limit, you can set sample_rate to something like 0.2. Doing this well prevent Perfherder from sending 80% of the data it collects.