google / ioweb2016

I/O web app 2016
https://events.google.com/io2016
Apache License 2.0
518 stars 87 forks source link

Improve performance timing reporting capabilities #936

Closed philipwalton closed 8 years ago

philipwalton commented 8 years ago

This PR adds a new custom dimension to make it easier to report on performance timing of this data in Google Analytics. A limitation of GA currently is you can typically only report on a metric's total or average. You can't calculate its median or plot its distribution.

By adding a new custom dimension (called "Metric Value") to all perf hits, we'll be able to report on these values both as metrics (to get aggregates and take advantage of metric filters and segments) as well as by dimension, so we can break down the individual hits subdivided by value.

I've been testing this technique for a few days on another site measuring web font load times, and I'm able to report on the data like this via the API:

screen shot 2016-05-14 at 11 34 20 am

As you can see, I'm able to calculate a median doing it this way: 930ms. FWIW, the average value for this same dataset is 1640ms, so doing it this way gives us way more insight.


In addition to adding this dimension, the PR fixes a bug where the analytics timeout event value wasn't being rounded. It also converts all bound functions to fat arrow functions.

ebidel commented 8 years ago

Sick!