{"action":"created","comment":{"url":"https://api.github.com/repos/google/WebFundamentals/pulls/comments/72105075","id":72105075,"diff_hunk":"@@ -0,0 +1,679 @@\n+project_path: /web/_project.yaml\n+book_path: /web/showcase/_book.yaml\n+description: Measuring the Real-world Performance Impact of Service Workers\n+\n+{# wf_published_on: 2016-07-22T18:00:00.000Z #}\n+{# wf_updated_on: 2016-07-22T18:00:00.000Z #}\n+{# wf_author: philipwalton #}\n+{# wf_featured_image: /web/showcase/2016/images/service-worker-perf/desktop-all.png #}\n+{# wf_featured_snippet: One of the most significant benefits of service workers (from a performance perspective, at least) is their ability to proactively control the caching of assets. A web application that can cache all of its necessary resources should load substantially faster for returning visitors. But what do these gains actually look like to real users? And how do you even go about measuring this? #}\n+\n+<style>\n+td[align=\"right\"] {\n+  text-align: right!important;\n+}\n+.pull-quote {\n+  font-size: 1.75em;\n+  font-style: italic;\n+  font-weight: 300;\n+  line-height: 1.2;\n+  padding: 1em 2em;\n+}\n+</style>\n+\n+# Measuring the Real-world Performance Impact of Service Workers {: .page-title }\n+\n+One of the most significant benefits of [service workers](/web/fundamentals/primers/service-worker/) (from a performance perspective, at least) is their ability to proactively control the caching of assets. A web application that can cache all of its necessary resources should load substantially faster for returning visitors. But what do these gains actually look like to real users? And how do you even go about measuring this?\n+\n+The [Google I/O web app](https://events.google.com/io2016/) (IOWA for short) is a [progressive web app](/web/progressive-web-apps/) that leveraged most of the new capabilities offered by service workers to deliver a rich, app-like experience to its users. It also used Google Analytics to capture key performance data and usage patterns from its large and diverse user audience.\n+\n+This case study explores how IOWA used Google Analytics to answer key performance questions and report on the real-world impact of service workers.\n+\n+## Starting with the questions\n+\n+Any time you implement analytics in a website or application, it's important to start by identifying the questions you're trying to answer from the data you'll be  collecting.\n+\n+While we had several questions we wanted to answer, for the purposes of this case study, let's focus on two of the more interesting ones.\n+\n+**1. Is service worker caching more performant than the existing HTTP caching mechanisms available in all browsers?**\n+\n+We already expect pages to load faster for returning visitors than for new visitors since browsers can cache requests and serve them instantly on repeat visits.\n+\n+Service workers offers alternative caching capabilities that give developers fine-grained control over exactly what and how caching is done. In IOWA, we optimized our service worker implementation so that every asset would be cached, so returning visitors could use the app completely offline.\n+\n+But would this effort end up being any better than what the browser already does by default? And if so, how much better?&nbsp;<sup><a href=\"#footnotes\">[1]</a></sup>\n+\n+**2. How does service worker impact the experience of the site loading?**\n+\n+In other words, how fast does it *feel* like the site is loading, regardless of the actual load times as measured by traditional page load metrics?\n+\n+Answering questions about how an experience feels is obviously not an easy task, and no metric is going to perfectly represent such a subjective sentiment. That being said, there are definitely some metrics that are better than others, so choosing the right ones is important.\n+\n+### Choosing the right metric\n+\n+Google Analytics, by default, tracks [page load times](https://support.google.com/analytics/answer/1205784) (via the [Navigation Timing API](https://developer.mozilla.org/en-US/docs/Web/API/Navigation_timing_API)) for 1% of a site's visitors, and it makes that data available via metrics like [Avg. Page Load Time](/analytics/devguides/reporting/core/dimsmets#view=detail&group=site_speed&jump=ga_avgpageloadtime).\n+\n+*Avg. Page Load Time* is a good metric for answering our first question, but it's not a particularly good metric for answering the second. For one thing the `load` event doesn't necessarily correspond to the moment when the user can actually interact with the app. Moreover, two apps with the exact same load time may *feel* like they load much differently. For example, a site with a splash screen or a loading indicator probably feels like it loads much faster than a site that just shows a blank page for several seconds.\n+\n+In IOWA, we showed a splash screen countdown animation that (in my opinion) very successfully served to entertain the user while the rest of the app loaded in the background. Because of this, tracking how long it takes the splash screen to appear makes a lot more sense as a way to measure perceived load performance. We chose the metric **time to first paint** to get this value.\n+\n+Once we decided on the questions we wanted to answer and identified the metrics that would be useful in answering them, it was time to implement Google Analytics and start measuring.\n+\n+## The analytics implementation\n+\n+If you've used Google Analytics before, then you're probably familiar with the [recommended JavaScript tracking snippet](/analytics/devguides/collection/analyticsjs/#alternative_async_tracking_snippet). It looks like this:\n+\n+<pre class=\"prettyprint\">{% htmlescape %}\n+<script>\n+window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;\n+ga('create', 'UA-XXXXX-Y', 'auto');\n+ga('send', 'pageview');\n+</script>\n+<script async src=\"https://www.google-analytics.com/analytics.js\"></script>\n+{% endhtmlescape %}</pre>\n+\n+The first line in the above code initializes a global `ga()` function (if it doesn't already exist), and the last line asynchronously downloads the `analytics.js` library.\n+\n+The middle part contains these two lines:\n+\n+<pre class=\"prettyprint\">\n+ga('create', 'UA-XXXXX-Y', 'auto');\n+ga('send', 'pageview');\n+</pre>\n+\n+These two [commands](/analytics/devguides/collection/analyticsjs/how-analyticsjs-works#the_ga_command_queue) track what pages are visited by people going to your site, but [not much more](/analytics/devguides/collection/analyticsjs/#what_data_does_the_tracking_snippet_capture). If you want to track additional user interactions, you have to do so yourself.\n+\n+For IOWA, we wanted to track two additional things:\n+\n+* The amount of time that elapses between when the page first starts to load and when pixels appear on the screen.\n+* Whether or not a service worker is controlling the page. With this information we could then segment our reports to compare the results with and without service worker.\n+\n+### Capturing time to first paint\n+\n+Some browsers record the precise time at which the first pixel is painted to the screen, and they make that time available to developers. That value, compared with the `navigationStart` value exposed via the [Navigation Timing API](https://developer.mozilla.org/en-US/docs/Web/API/Navigation_timing_API) gives us a very accurate accounting of how much time has passed between when the user initially requested the page and when they first saw something.\n+\n+As I already mentioned, time to first paint is an important metric to measure because it's the first point at which a user experiences the load speed of your site. It's the first impression users get, and a good first impression can positively affect the rest of the user experience.&nbsp;<sup><a href=\"#footnotes\">[2]</a></sup>\n+\n+To get the first paint value in browsers that expose it, we created the `getTimeToFirstPaintIfSupported` utility function:\n+\n+<pre class=\"prettyprint\">{% htmlescape %}\n+function getTimeToFirstPaintIfSupported() {\n+  // Ignores browsers that don't support the Performance Timing API.\n+  if (window.performance && window.performance.timing) {\n+    var navTiming = window.performance.timing;\n+    var navStart = navTiming.navigationStart;\n+    var fpTime;\n+\n+    // If chrome, get first paint time from `chrome.loadTimes`.\n+    if (window.chrome && window.chrome.loadTimes) {\n+      fpTime = window.chrome.loadTimes().firstPaintTime * 1000;\n+    }\n+    // If IE/Edge, use the prefixed `msFirstPaint` property.\n+    // See http://msdn.microsoft.com/ff974719\n+    else if (navTiming.msFirstPaint) {\n+      fpTime = navTiming.msFirstPaint;\n+    }\n+\n+    if (fpTime && navStart) {\n+      return fpTime - navStart;\n+    }\n+  }\n+}\n+{% endhtmlescape %}</pre>\n+\n+<aside class=\"caution\">\n+  <strong>Important:</strong> the <code>firstpaint</code> values referenced in the above function are part of vendor-specific APIs. They are non-standard and subject to change (or removal) at any time. We chose to implement them in IOWA knowing the site would have a limited lifespan. For most sites, it's best to use other <a href=\"https://speedcurve.com/blog/user-timing-and-custom-metrics/\">User Timing techniques</a> until a <code>firstpaint</code> (or a <code>firstpaint</code> alternative) is standardized.\n+</aside>\n+\n+With this, we could now write another function that [sends](/analytics/devguides/collection/analyticsjs/sending-hits) a [non-interaction](https://support.google.com/analytics/answer/1033068#NonInteractionEvents) event with the time to first paint as its value:&nbsp;<sup><a href=\"#footnotes\">[3]</a></sup>\n+\n+<pre class=\"prettyprint\">\n+function sendTimeToFirstPaint() {\n+  var timeToFirstPaint = getTimeToFirstPaintIfSupported();\n+\n+  if (timeToFirstPaint) {\n+    ga('send', 'event', {\n+      eventCategory: 'Performance',\n+      eventAction: 'firstpaint',\n+      // Rounds to the nearest millisecond since\n+      // event values in Google Analytics must be integers.\n+      eventValue: Math.round(timeToFirstPaint)\n+      // Sends this as a non-interaction event,\n+      // so it doesn't affect bounce rate.\n+      nonInteraction: true\n+    });\n+  }\n+}\n+</pre>\n+\n+After writing both of these functions, our tracking code looks like this:\n+\n+<pre class=\"prettyprint\">\n+// Creates the tracker object.\n+ga('create', 'UA-XXXXX-Y', 'auto');\n+\n+// Sends a pageview for the initial pageload.\n+ga('send', 'pageview');\n+\n+// Sends an event with the time to first paint data.\n+sendTimeToFirstPaint();\n+</pre>\n+\n+Note that depending on when the above code runs, pixel may or may not have already been painted to the screen. To ensure we always run this code after the first paint occurs, we postponed the call to `sendTimeToFirstPaint()` until after the `load` event. In fact, we decided to postpone sending all analytics data until after the page was loaded to ensure those requests wouldn't compete with the loading of other resources.\n+\n+<pre class=\"prettyprint\">\n+// Creates the tracker object.\n+ga('create', 'UA-XXXXX-Y', 'auto');\n+\n+// Postpones sending any hits until after the page has fully loaded.\n+// This prevents analytics requests from delaying the loading of the page.\n+<strong>window.addEventListener('load', function() {\n+  // Sends a pageview for the initial pageload.\n+  ga('send', 'pageview');\n+\n+  // Sends an event with the time to first paint data.\n+  sendTimeToFirstPaint();\n+});</strong>\n+</pre>\n+\n+The code above reports `firstpaint` times to Google Analytics, but that's only half the story. We still needed to track the service worker status; otherwise we wouldn't be able to compare the first paint times of a service worker-controlled page and a non-controlled page.\n+\n+### Determining service worker status\n+\n+To determine the current status of the service worker, we created a utility function that returns  one of three values:\n+\n+- **controlled**: a service worker is controlling the page. In the case of IOWA that also means all assets have been cached and the page works offline.\n+- **supported**: the browser supports service worker, but the service worker is not yet controlling the page. This is the expected status for first time visitors.\n+- **unsupported**: the user's browser does not support service worker.\n+\n+<pre class=\"prettyprint\">\n+function getServiceWorkerStatus() {\n+  if ('serviceWorker' in navigator) {\n+    return navigator.serviceWorker.controller ? 'controlled' : 'supported';\n+  } else {\n+    return 'unsupported';\n+  }\n+}\n+</pre>\n+\n+This function got the service worker status for us; the next step was to associate this status with the data we were sending to Google Analytics.\n+\n+#### Tracking custom data with custom dimensions\n+\n+By default, Google Analytics gives you lots of ways to subdivide your total traffic into groups based on attributes of the user, session, or interaction. These attributes are known as [dimensions](https://support.google.com/analytics/answer/1033861). Common dimensions web developers care about are things like [Browser](/analytics/devguides/reporting/core/dimsmets#view=detail&group=platform_or_device&jump=ga_browser), [Operating System](/analytics/devguides/reporting/core/dimsmets#view=detail&group=platform_or_device&jump=ga_operatingsystem), or [Device Category](/analytics/devguides/reporting/core/dimsmets#view=detail&group=platform_or_device&jump=ga_devicecategory).\n+\n+The service worker's status is not a dimension Google Analytics provides by default; however, Google Analytics does give you the ability to create your own [custom dimensions](https://support.google.com/analytics/answer/2709828) and define them however you want.\n+\n+For IOWA, we created a custom dimension called *Service Worker Status* and set its scope to [hit](https://support.google.com/analytics/answer/2709828#example-hit) (i.e. per-interaction).&nbsp;<sup><a href=\"#footnotes\">[4]</a></sup> Each custom dimension you create in Google Analytics is given a unique index within that property, and in your tracking code you can reference that dimension by its index. For example, if the index of the dimension we just created were 1, we could update our logic as follows to send the `firstpaint` event to include the service worker status:\n+\n+<pre class=\"prettyprint\">\n+ga('send', 'event', {\n+  eventCategory: 'Performance',\n+  eventAction: 'firstpaint',\n+  // Rounds to the nearest millisecond since\n+  // event values in Google Analytics must be integers.\n+  eventValue: Math.round(timeToFirstPaint)\n+  // Sends this as a non-interaction event,\n+  // so it doesn't affect bounce rate.\n+  nonInteraction: true,\n+\n+  <strong>// Sets the current service worker status as the value of\n+  // `dimension1` for this event.\n+  dimension1: getServiceWorkerStatus()</strong>\n+});\n+</pre>\n+\n+This works, but it will only associate the service worker's status with this particular event. Since *Service Worker Status* is something that's potentially useful to know for any interaction, it's best to include it with all data sent to Google Analytics.\n+\n+To include this information in all hits (e.g. all pageviews, events, etc.) we [set](/analytics/devguides/collection/analyticsjs/accessing-trackers#updating_tracker_data) the custom dimension value on the [tracker](/analytics/devguides/collection/analyticsjs/creating-trackers) object itself, prior to sending any data to Google Analytics.\n+\n+<pre class=\"prettyprint\">\n+ga('set', 'dimension1', getServiceWorkerStatus());\n+</pre>\n+\n+Once set, this value gets sent with all subsequent hits for the current pageload. If the user load the page again later, a new value will likely be returned from the `getServiceWorkerStatus` function, and that value will be set on the tracker object.\n+\n+A quick note on code clarity and readability: since other people looking at this code may not know what `dimension1` refers to, it's always best to create a variable that maps meaningful dimension names to the values analytics.js will use.\n+\n+<pre class=\"prettyprint\">\n+<strong>// Creates a map between custom dimension names and their index.\n+// This is particularly useful if you define lots of custom dimensions.\n+var customDimensions = {\n+  SERVICE_WORKER_STATUS: 'dimension1'\n+};</strong>\n+\n+// Creates the tracker object.\n+ga('create', 'UA-XXXXX-Y', 'auto');\n+\n+<strong>// Sets the service worker status on the tracker,\n+// so its value is included in all future hits.\n+ga('set', customDimensions.SERVICE_WORKER_STATUS, getServiceWorkerStatus());</strong>\n+\n+// Postpones sending any hits until after the page has fully loaded.\n+// This prevents analytics requests from delaying the loading of the page.\n+window.addEventListener('load', function() {\n+  // Sends a pageview for the initial pageload.\n+  ga('send', 'pageview');\n+\n+  // Sends an event with the time to first paint data.\n+  sendTimeToFirstPaint();\n+});\n+</pre>\n+\n+As I mentioned, sending the *Service Worker Status* dimension with every hit allows us to use it when reporting on any metric. For example, here's what service worker usage looked like for all pageviews during the week of Google I/O:\n+\n+<iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/a/google.com/spreadsheets/d/18uCZKpkXii3eD2Z9pzqNdIYa8sjCI-zOnHjr5KkZmaE/pubchart?oid=537990599&amp;format=interactive\"></iframe>\n+\n+As you can see almost 85% of all pageviews for IOWA were from browsers that [support service worker](https://jakearchibald.github.io/isserviceworkerready/).\n+\n+## The results: answering our questions\n+\n+Once we updated our tracking implementation to track the data needed to answer our original questions, we could start reporting on that data to see the results. *(Note: all Google Analytics data shown here represents actual web traffic to the IOWA site from May 16-22, 2016).*\n+\n+The first question we had was: *Is service worker caching more performant than the existing HTTP caching mechanisms available in all browsers?*\n+\n+To answer that question, we created a [custom report](https://support.google.com/analytics/answer/1033013) that looked at the metric [Avg. Page Load Times](/analytics/devguides/reporting/core/dimsmets#view=detail&group=site_speed&jump=ga_avgpageloadtime) across various dimensions. This metric is well-suited to answer this question because the `load` event fires only after all initial resources are downloaded. Thus it directly reflects the total load time for all the site's critical resources.&nbsp;<sup><a href=\"#footnotes\">[5]</a></sup>\n+\n+The dimensions we chose were:\n+\n+* Our custom *Service Worker Status* dimension.\n+* [User Type](/analytics/devguides/reporting/core/dimsmets#view=detail&group=user&jump=ga_usertype), which indicates whether this is the user's first visit to the site or if they're returning. (Note: a new visitor will not have any resources cached; a returning visitor might.)\n+* [Device Category](/analytics/devguides/reporting/core/dimsmets#view=detail&group=platform_or_device&jump=ga_devicecategory), which lets us compare the results across mobile and desktop.\n+\n+To control for the possibility that non-service-worker-related factors were skewing our load time results, we limited our query to only include browsers that support service worker.\n+\n+The chart below shows the average page load times across desktop and mobile for service worker controlled pages and non-controlled pages:\n+\n+<iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/a/google.com/spreadsheets/d/18uCZKpkXii3eD2Z9pzqNdIYa8sjCI-zOnHjr5KkZmaE/pubchart?oid=1528363694&amp;format=interactive\"></iframe>\n+\n+As you can see, visits to our app when controlled by a service worker loaded quite a bit faster than non-controlled visits, even those from returning users who likely had most of the page's resources cached. It's also interesting to notice that, on average, visitors on mobile with a service worker saw faster loads than new desktop visitors.\n+\n+<div class=\"pull-quote\">\"&hellip;visits to our app when controlled by a service worker loaded quite a bit faster than non-controlled visits&hellip;\"</div>\n+\n+You can see more details in the following two tables:\n+\n+\n+<table>\n+  <tr><th colspan=\"4\">Avg. Page Load Time (Desktop)</th></tr>\n+  <tr class=\"alt\">\n+    <td><b>Service Worker Status</b></td>\n+    <td><b>User Type</b></td>\n+    <td align=\"right\"><b>Avg. Page Load Time (ms)</b></td>\n+    <td align=\"right\"><b>Sample Size</b></td>\n+  </tr>\n+  <tr>\n+    <td>Controlled</td>\n+    <td>Returning Visitor</td>\n+    <td align=\"right\" style=\"background:#ffc\">\n+      <strong>2568</strong></p>\n+    </td>\n+    <td align=\"right\">30860</p></td>\n+  </tr>\n+  <tr>\n+    <td>Supported</td>\n+    <td>Returning Visitor\n+    </td>\n+    <td align=\"right\" style=\"background:#ffc\">\n+      <strong>3612</strong>\n+    </td>\n+    <td align=\"right\">1289</td>\n+  </tr>\n+  <tr>\n+    <td>Supported</td>\n+    <td>New Visitor</td>\n+    <td align=\"right\" style=\"background:#ffc\">\n+      <strong>4664</strong>\n+    </td>\n+    <td align=\"right\">21991</td>\n+  </tr>\n+</table>\n+\n+<table>\n+  <tr><th colspan=\"4\">Avg. Page Load Time (Mobile)</th></tr>\n+  <tr class=\"alt\">\n+    <td><b>Service Worker Status</b></td>\n+    <td><b>User Type</b></td>\n+    <td align=\"right\"><b>Avg. Page Load Time (ms)</b></td>\n+    <td align=\"right\"><b>Sample Size</b></td>\n+  </tr>\n+  <tr>\n+    <td>Controlled</td>\n+    <td>Returning Visitor</td>\n+    <td align=\"right\" style=\"background:#ffc\">\n+      <strong>3760</strong>\n+    </td>\n+    <td align=\"right\">8162</td>\n+  </tr>\n+  <tr>\n+    <td>Supported</td>\n+    <td>Returning Visitor</td>\n+    <td align=\"right\" style=\"background:#ffc\">\n+      <strong>4843</strong>\n+    </td>\n+    <td align=\"right\">676</td>\n+  </tr>\n+  <tr>\n+    <td>Supported</td>\n+    <td>New Visitor</td>\n+    <td align=\"right\" style=\"background:#ffc\">\n+      <strong>6158</strong>\n+    </td>\n+    <td align=\"right\">5779</td>\n+  </tr>\n+</table>\n+\n+You may be wondering how it's possible for a returning visitor whose browser supports service worker to ever be in a non-controlled state. There are a few possible explanations for this:\n+\n+* The user left the page on the initial visit before the service worker had a chance to finish initializing.\n+* The user uninstalled the service worker via the developer tools.\n+\n+Both of these situations are relatively rare. We can see that in the data by looking at the [Page Load Sample](/analytics/devguides/reporting/core/dimsmets#view=detail&group=site_speed&jump=ga_pageloadsample) values in the fourth column. Notice that the middle rows have a much smaller sample than the other two.\n+\n+Our second question was: *How does service worker impact the experience of the site loading?*\n+\n+To answer this question, we created another custom report for the metric [Avg. Event Value](/analytics/devguides/reporting/core/dimsmets#view=detail&group=event_tracking&jump=ga_avgeventvalue) and filtered the results to only include our `firstpaint` events. We used the dimensions *Device Category* and our custom *Service Worker Status* dimension:\n+\n+<iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/a/google.com/spreadsheets/d/18uCZKpkXii3eD2Z9pzqNdIYa8sjCI-zOnHjr5KkZmaE/pubchart?oid=673302558&amp;format=interactive\"></iframe>\n+\n+To better visualize how the `firstpaint` events related to the overall page load times, we created a timeline chart plotting both events for mobile and desktop:\n+\n+<iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/a/google.com/spreadsheets/d/18uCZKpkXii3eD2Z9pzqNdIYa8sjCI-zOnHjr5KkZmaE/pubchart?oid=1187664125&amp;format=interactive\"></iframe>\n+\n+<iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/a/google.com/spreadsheets/d/18uCZKpkXii3eD2Z9pzqNdIYa8sjCI-zOnHjr5KkZmaE/pubchart?oid=610404153&amp;format=interactive\"></iframe>\n+\n+Contrary to what I would have expected, the service worker on mobile had much less impact on time to first paint than it did on overall page load.\n+\n+<div class=\"pull-quote\">\"&hellip;service worker on mobile had much less impact on time to first paint than it did on overall page load.\"</div>\n+\n+To explore why this is the case, we have to dig deeper into the data. Averages can be good for general overviews and broad strokes, but to really get a sense of how these numbers break down across a range of users, we need to look at a distribution of `firstpaint` times.\n+\n+### Getting the distribution of a metric in Google Analytics\n+\n+To get the distribution of `firstpaint` times we need access to the individual results for each event. Unfortunately, Google Analytics doesn't make this easy.\n+\n+Google Analytics lets us break down a report by whatever dimension we want, but it doesn't let use break down a report by metrics. That isn't to say it's impossible, it just means we had to customize our implementation a bit more to get the desired result.\n+\n+Since report results can only be broken down by dimensions, we had to set the metric value (in this case `firstpaint` time) as a custom dimension on the event. To do this we created another custom dimension called *Metric Value* and updated our `firstpaint` tracking logic as follows:\n+\n+<pre class=\"prettyprint\">\n+var customDimensions = {\n+  SERVICE_WORKER_STATUS: 'dimension1',\n+  <strong>METRIC_VALUE: 'dimension2'</strong>\n+};\n+\n+// ...\n+\n+function sendTimeToFirstPaint() {\n+  var timeToFirstPaint = getTimeToFirstPaintIfSupported();\n+\n+  if (timeToFirstPaint) {\n+    var fields = {\n+      eventCategory: 'Performance',\n+      eventAction: 'firstpaint',\n+      // Rounds to the nearest millisecond since\n+      // event values in Google Analytics must be integers.\n+      eventValue: Math.round(timeToFirstPaint)\n+      // Sends this as a non-interaction event,\n+      // so it doesn't affect bounce rate.\n+      nonInteraction: true\n+    }\n+\n+    <strong>// Sets the event value as a dimension to allow for breaking down the\n+    // results by individual metric values at reporting time.\n+    fields[customDimensions.METRIC_VALUE] = String(fields.eventValue);</strong>\n+\n+    ga('send', 'event', fields);\n+  }\n+}\n+</pre>\n+\n+The Google Analytics web interface does not currently provide a way to visualize the distribution of arbitrary metric values, but with the help of the [Google Analytics Core Reporting API](/analytics/devguides/reporting/core/v4/) and the [Google Charts library](/chart/interactive/docs/gallery/histogram) we could query for the raw results and then construct a histogram ourselves.\n+\n+For example, the following API request configuration was used to get a distribution of `firstpaint` values on desktop with a non-controlled service worker.\n+\n+<pre class=\"prettyprint\">\n+{\n+  dateRanges: [{startDate: '2016-05-16', endDate: '2016-05-22'}],\n+  metrics: [{expression: 'ga:totalEvents'}],\n+  dimensions: [{name: 'ga:dimension2'}],\n+  dimensionFilterClauses: [\n+    {\n+      operator: 'AND',\n+      filters: [\n+        {\n+          dimensionName: 'ga:eventAction',\n+          operator: 'EXACT',\n+          expressions: ['firstpaint']\n+        },\n+        {\n+          dimensionName: 'ga:dimension1',\n+          operator: 'EXACT',\n+          expressions: ['supported']\n+        },\n+        {\n+          dimensionName: 'ga:deviceCategory',\n+          operator: 'EXACT',\n+          expressions: ['desktop']\n+        }\n+      ],\n+    }\n+  ],\n+  orderBys: [\n+    {\n+      fieldName: 'ga:dimension2',\n+      orderType: 'DIMENSION_AS_INTEGER'\n+    }\n+  ]\n+}\n+</pre>\n+\n+This API request returns an array of values that look like this (Note: these are just the first five results). The results are sorted from smallest to largest, so these rows represent the fastest times.\n+\n+<table>\n+  <tr><th colspan=\"2\">API Response Results (first five rows)</th></tr>\n+  <tr class=\"alt\">\n+    <td><b>ga:dimension2</b></td>\n+    <td align=\"right\"><b>ga:totalEvents</b></td>\n+  </tr>\n+  <tr>\n+    <td>4</td>\n+    <td align=\"right\">3</td>\n+  </tr>\n+  <tr>\n+    <td>5</td>\n+    <td align=\"right\">2</td>\n+  </tr>\n+  <tr>\n+    <td>6</td>\n+    <td align=\"right\">10</td>\n+  </tr>\n+  <tr>\n+    <td>7</td>\n+    <td align=\"right\">8</td>\n+  </tr>\n+  <tr>\n+    <td>8</td>\n+    <td align=\"right\">10</td>\n+  </tr>\n+</table>\n+\n+Here's what these results mean in plain English:\n+\n+* There were 3 events where the `firstpaint` value was 4 ms\n+* There were 2 events where the `firstpaint` value was 5 ms\n+* There were 10 events where the `firstpaint` value was 6 ms\n+* There were 8 events where the `firstpaint` value was 7 ms\n+* There were 10 events where the `firstpaint` `value` was 8 ms\n+* etc.\n+\n+From these results we can extrapolate the `firstpaint` value for every single event and create a histogram of the distribution. We did this for each of the queries we ran.\n+\n+Here's what the distribution looked like on desktop with a non-controlled (but supported) service worker:\n+\n+<img src=\"images/service-worker-perf/desktop-no-sw.png\" alt=\"Time to first paint distribution on Desktop (supported)\">\n+\n+The median `firstpaint` time for the above distribution is **912 ms**.\n+\n+The shape of this curve is quite typical of load time distributions. Contrast that with the histogram below which shows the distribution of first paint events for visits in which a service worker was controlling the page.\n+\n+<img src=\"images/service-worker-perf/desktop-sw.png\" alt=\"Time to first paint distribution on Desktop (controlled)\">\n+\n+Notice how when a service worker was controlling the page, many visitors experienced a near-immediate first paint, with a median of **583 ms**.\n+\n+<div class=\"pull-quote\">\"&hellip;when a service worker was controlling the page, many visitors experienced a near-immediate first paint&hellip;\"</div>\n+\n+To get a better sense of how these two distributions compare to each other, the next chart shows a merged view of the two. The histogram showing non-controlled service worker visits is overlaid on top of the histogram showing controlled visits, and both of those are overlaid on top of a histogram showing both combined.\n+\n+<img src=\"images/service-worker-perf/desktop-all.png\" alt=\"Time to first paint distribution on Desktop\">\n+\n+One thing I found interesting about these results was that the distribution with a controlled service worker still had a bell-shaped curve after the initial spike. I was expecting a large initial spike and then a gradual trail off, I wasn't expecting a second peak in the curve.\n+\n+When I looked into what might be causing this, I learned that even though a service worker can be controlling a page, its thread can be inactive. The browser does this to [save resources](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#motivations)&mdash;obviously you don't need every service worker for every site you've ever visited to be active and ready at a moment's notice. This explains the tail of the distribution. For some users, there was a delay while the service worker thread started up.\n+\n+As you can see from the distribution though, even with this initial delay, browsers with service worker delivered content faster than browsers going through the network.\n+\n+Here's how things looked on mobile:\n+\n+<img src=\"images/service-worker-perf/mobile-all.png\" alt=\"Time to first paint distribution on Mobile\">\n+\n+While we still had a sizeable increase in near-immediate first paint times, the tail was quite a bit larger and longer. This is likely due to the fact that, on mobile, starting an idle service worker thread takes longer than it does on desktop. It also explains why the difference between average `firstpaint` time wasn't as big as I was expecting (discussed above).\n+\n+<div class=\"pull-quote\">\"&hellip;on mobile, starting an idle service worker thread takes longer than it does on desktop.\"</div>\n+\n+Here is the breakdown from these variations of median first paint times on mobile and desktop grouped by service worker status:\n+\n+<table>\n+  <tr><th colspan=\"3\">Median Time to First Paint (ms)</th></tr>\n+  <tr class=\"alt\">\n+    <td><b>Service Worker Status</b></td>\n+    <td align=\"right\"><b>Desktop</b></td>\n+    <td align=\"right\"><b>Mobile</b></td>\n+  <tr>\n+  <tr>\n+    <td>Controlled</td>\n+    <td align=\"right\">583</td>\n+    <td align=\"right\">1634</td>\n+  </tr>\n+  <tr>\n+    <td>Supported (not controlled)</td>\n+    <td align=\"right\">912</td>\n+    <td align=\"right\">1933</td>\n+  </tr>\n+</table>\n+\n+While building these distribution visualizations took a bit more time and effort than creating a custom report in Google Analytics, they give us a far better sense of how service workers affect the performance of our site than averages alone.\n+\n+## Other impact from Service Workers\n+\n+In addition to the performance impact, service workers also impact the user experience in several other ways that are measurable with Google Analytics.\n+\n+### Offline access\n+\n+Service workers allow users to interact with your site while offline, and while some sort of offline support is probably critical for any progressive web app, determining how critical it is in your case largely depends on how much usage is occurring offline. But how do we measure that?\n+\n+Sending data to Google Analytics requires an internet connection, but it doesn't require the data to be sent at the exact time the interaction took place. Google Analytics supports sending interaction data after the fact by  specifying a time offset (via the <code>[qt](/analytics/devguides/collection/protocol/v1/parameters#qt)</code> parameter).\n+\n+For the past two years IOWA has been using a [service worker script](https://www.npmjs.com/package/sw-offline-google-analytics) that detects failed hits to Google Analytics when the user is offline and replays them later with the `qt` parameter.\n+\n+To track whether the user was online or offline, we created a custom dimension called *Online* and set it to the value of `navigator.onLine`, we then listened for the `online` and `offline` events and updated the dimension accordingly.\n+\n+And to get a sense for how common it was for a user to be offline while using IOWA, we created a [segment](https://support.google.com/analytics/answer/3123951) that targeted users with at least one offline interaction. Turns out, that was almost 5% of users:\n+\n+<iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/a/google.com/spreadsheets/d/18uCZKpkXii3eD2Z9pzqNdIYa8sjCI-zOnHjr5KkZmaE/pubchart?oid=1623911536&amp;format=interactive\"></iframe>\n+\n+### Push notifications\n+\n+Service workers allow users to opt-in to receiving push notifications. In IOWA, users were notified when a session in their schedule was about to start.\n+\n+As with any form of notifications, it's important to find the balance between providing value to the user and annoying them. To better understand which is happening, it's important to track whether users are opting-in to receive these notifications, if they're engaging with them when they arrive, and if any users who previously opted-in change their preference and opt-out.\n+\n+In IOWA, we only sent notifications related to the user's personalized schedule, something only logged-in users could create. This limited the set of users who could receive notifications to logged-in users (tracked via a custom dimension called *Signed In*) whose browsers supported push notifications (tracked via another custom dimension called *Notification Permission*).\n+\n+The following report is based on the metric [Users](/analytics/devguides/reporting/core/dimsmets#view=detail&group=user&jump=ga_users) and our Notification Permission custom dimension, segmented by users who signed in at some point and whose browsers support push notifications.\n+\n+<iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/a/google.com/spreadsheets/d/18uCZKpkXii3eD2Z9pzqNdIYa8sjCI-zOnHjr5KkZmaE/pubchart?oid=1028704919&amp;format=interactive\"></iframe>\n+\n+It's great to see that more than half of our signed-in users opted in to receiving push notifications.\n+\n+### App install banners\n+\n+If a progress web app meets the [criteria](/web/fundamentals/engage-and-retain/app-install-banners/web-app-install-banners) and is used frequently by a user, that user may be shown an app install banner, prompting them to add the app to their home screen.\n+\n+In IOWA, we tracked how often these prompts were shown to the user (and whether they were accepted) with the following code:\n+\n+<pre class=\"prettyprint\">\n+window.addEventListener('beforeinstallprompt', function(event) {\n+  // Tracks that the user saw a prompt.\n+  ga('send', 'event', {\n+    eventCategory: 'installprompt',\n+    eventAction: 'fired'\n+  });\n+\n+  event.userChoice.then(function(choiceResult) {\n+    // Tracks the users choice.\n+    ga('send', 'event', {\n+      eventCategory: 'installprompt',\n+      // `choiceResult.outcome` will be 'accepted' or 'dismissed'.\n+      eventAction: choiceResult.outcome,\n+      // `choiceResult.platform` will be 'web' or 'android' if the prompt was\n+      // accepted, or '' if the prompt was dismissed.\n+      eventLabel: choiceResult.platform\n+    });\n+  });\n+});\n+</pre>\n+\n+Of the users who saw an app install banner, about 10% chose to add it to their home screen.\n+\n+<iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/a/google.com/spreadsheets/d/18uCZKpkXii3eD2Z9pzqNdIYa8sjCI-zOnHjr5KkZmaE/pubchart?oid=1347385203&amp;format=interactive\"></iframe>\n+\n+## Possible tracking improvements (for next time)\n+\n+The analytics data we collected from IOWA this year was invaluable. But hindsight always brings to light holes and opportunities to improve things for the next time around. After finishing this year's analysis, here are two things I wish we'd done differently that readers looking to implement a similar strategy might want to consider:\n+\n+**1. Track more events related to the load experience**\n+\n+We tracked several events that correspond to a technical metric (e.g. [HTMLImportsLoaded](http://webcomponents.org/polyfills/html-imports/), [WebComponentsReady](https://github.com/webcomponents/webcomponentsjs#webcomponentsready), etc.), but since so much of the load was done asynchronously, the point at which these events fired didn't necessarily correspond with a particular moment in the overall load experience.\n+\n+The primary load-related event we didn't track (but wish we had) is the point at which the splash screen disappeared and the user could see the page content.\n+\n+**2. Store the analytics client ID in IndexedDB**\n+\n+By default, analytics.js stores the [client ID field](/analytics/devguides/collection/analyticsjs/cookies-user-id) in the browser's cookies; unfortunately, service worker scripts cannot access cookies.\n+\n+This presented a problem for us when we tried to implement notification tracking. We wanted to send an event from the service worker (via the [Measurement Protocol](/analytics/devguides/collection/protocol/)) each time a notification was sent to a user, and then track the re-engagement success of that notification if the user clicked on it and arrived back in the app.\n+\n+While we were able to track the success of notifications in general via the `utm_source` [campaign parameter](https://support.google.com/analytics/answer/1033863#parameters), we weren't able to tie a particular re-engagement session to a particular user.\n+\n+What we could have done to workaround this limitation was store the client ID via IndexedDB in our tracking code, and then that value would have been accessible to the service worker script.\n+\n+**3. Let the service worker report online/offline status**\n+\n+Inspecting `navigator.onLine` will let you know if your browser is able to connect to the router or local area network, but it won't necessarily tell if you if the user has real connectivety. And since our offline analytics service worker script simply replayed failed hits (without modifying them, or marking them as failed), we were probably under-reporting our offline usage.\n+\n+In the future we should track both the status of `navigator.onLine` as well as whether the hit was replayed by the service worker due to an initial network failure. This will give us a more accurate picture of the true offline usage.\n+\n+## Wrapping up\n+\n+This case study has shown that using service worker did indeed improve the load performance of the Google I/O webapp across a wide range of browsers, networks, and devices. It has also shown that when you look at a distribution of the load data across a wide range of browsers, networks, and devices, you get much more insight into how this technology handles in real-world scenarios, and you discover performance characteristics that you may not have expected.\n+\n+Here were some of the key takeaways from the IOWA study:\n+\n+* On average, pages loaded quite a bit faster when a service worker was controlling the page than they did without a service worker, for both new and returning visitors.\n+* Visits to pages controlled by a service worker loaded almost instantly for many users.\n+* Service workers, when inactive, took a bit of time to start up. However, an inactive service worker still performed better than no service worker.\n+* The startup time for an inactive service worker was longer on mobile than on desktop.\n+\n+While the performance gains observed in one particular application are generally useful to report to the larger developer community, it's important to remember that these results are specific to the type of site IOWA is (an event site) and the type of audience IOWA has (mostly developers).\n+\n+If you're implementing service worker in your application, it's important that you implement your own measurement strategy, so you can assess your own performance and prevent future regression. If you do, please share your results so everyone can benefit!\n+\n+---\n+\n+<div id=\"footnotes\"><strong>Footnotes</strong></div>\n+\n+1. It's not entirely fair to compare the performance of our service worker cache implementation to the performance of our site with HTTP cache alone. Because we were optimizing IOWA for service worker, we didn't spend much time optimizing for HTTP cache. If we had, the results probably would have been different. To learn more about optimizing your site for HTTP cache, read [Optimizing Content Efficiently](/web/fundamentals/performance/optimizing-content-efficiency/http-caching).\n+2. Depending on how your site loads its styles and content, it's possible that the browser is able to paint prior to content or styles being available. In such cases, `firstpaint` may correspond to a blank white screen. If you use `firstpaint`, it's important to ensure it corresponds to a meaningful point in the loading of your site's resources.\n+3. Technically we could send a [timing](/analytics/devguides/collection/analyticsjs/user-timings) hit (which are non-interaction by default) to capture this information instead of an event. In fact, timing hits were added to Google Analytics specifically to track load metrics like this; however, timing hits get [heavily sampled](/analytics/devguides/collection/analyticsjs/user-timings#sampling_considerations) at processing time, and their values cannot be used in [segments](https://support.google.com/analytics/answer/3123951). Given these current limitations, non-interaction events remain better suited.\n+4. To better understand what scope to give a custom dimension in Google Analytics refer to the [Custom Dimension](https://support.google.com/analytics/answer/2709828) section of the Analytics help center. It's also important to understand the Google Analytics data model, which consists of Users, Sessions, and Interactions (hits). To learn more, watch the [Analytics Academy lesson on the Google Analytics Data Model](https://analyticsacademy.withgoogle.com/course/2/unit/1/lesson/3).","path":"src/content/en/showcase/2016/service-worker-perf.md","position":678,"original_position":678,"commit_id":"7cf29d0d8152572d93e71710c5d7e2841c3d8b08","original_commit_id":"7cf29d0d8152572d93e71710c5d7e2841c3d8b08","user":{"login":"jpmedley","id":8204171,"avatar_url":"https://avatars.githubusercontent.com/u/8204171?v=3","gravatar_id":"","url":"https://api.github.com/users/jpmedley","html_url":"https://github.com/jpmedley","followers_url":"https://api.github.com/users/jpmedley/followers","following_url":"https://api.github.com/users/jpmedley/following{/other_user}","gists_url":"https://api.github.com/users/jpmedley/gists{/gist_id}","starred_url":"https://api.github.com/users/jpmedley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpmedley/subscriptions","organizations_url":"https://api.github.com/users/jpmedley/orgs","repos_url":"https://api.github.com/users/jpmedley/repos","events_url":"https://api.github.com/users/jpmedley/events{/privacy}","received_events_url":"https://api.github.com/users/jpmedley/received_events","type":"User","site_admin":false},"body":"'Users, Sessions, and Interactions' should be lower case.","created_at":"2016-07-25T17:17:17Z","updated_at":"2016-07-25T17:17:17Z","html_url":"https://github.com/google/WebFundamentals/pull/3134#discussion_r72105075","pull_request_url":"https://api.github.com/repos/google/WebFundamentals/pulls/3134","_links":{"self":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/comments/72105075"},"html":{"href":"https://github.com/google/WebFundamentals/pull/3134#discussion_r72105075"},"pull_request":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/3134"}}},"pull_request":{"url":"https://api.github.com/repos/google/WebFundamentals/pulls/3134","id":78704904,"html_url":"https://github.com/google/WebFundamentals/pull/3134","diff_url":"https://github.com/google/WebFundamentals/pull/3134.diff","patch_url":"https://github.com/google/WebFundamentals/pull/3134.patch","issue_url":"https://api.github.com/repos/google/WebFundamentals/issues/3134","number":3134,"state":"open","locked":false,"title":"SW Perf Case Study","user":{"login":"petele","id":718038,"avatar_url":"https://avatars.githubusercontent.com/u/718038?v=3","gravatar_id":"","url":"https://api.github.com/users/petele","html_url":"https://github.com/petele","followers_url":"https://api.github.com/users/petele/followers","following_url":"https://api.github.com/users/petele/following{/other_user}","gists_url":"https://api.github.com/users/petele/gists{/gist_id}","starred_url":"https://api.github.com/users/petele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petele/subscriptions","organizations_url":"https://api.github.com/users/petele/orgs","repos_url":"https://api.github.com/users/petele/repos","events_url":"https://api.github.com/users/petele/events{/privacy}","received_events_url":"https://api.github.com/users/petele/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-25T15:47:21Z","updated_at":"2016-07-25T17:17:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"752228ad040ee6512202f34fb158da562dac5e2e","assignee":{"login":"philipwalton","id":326742,"avatar_url":"https://avatars.githubusercontent.com/u/326742?v=3","gravatar_id":"","url":"https://api.github.com/users/philipwalton","html_url":"https://github.com/philipwalton","followers_url":"https://api.github.com/users/philipwalton/followers","following_url":"https://api.github.com/users/philipwalton/following{/other_user}","gists_url":"https://api.github.com/users/philipwalton/gists{/gist_id}","starred_url":"https://api.github.com/users/philipwalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipwalton/subscriptions","organizations_url":"https://api.github.com/users/philipwalton/orgs","repos_url":"https://api.github.com/users/philipwalton/repos","events_url":"https://api.github.com/users/philipwalton/events{/privacy}","received_events_url":"https://api.github.com/users/philipwalton/received_events","type":"User","site_admin":false},"assignees":[{"login":"philipwalton","id":326742,"avatar_url":"https://avatars.githubusercontent.com/u/326742?v=3","gravatar_id":"","url":"https://api.github.com/users/philipwalton","html_url":"https://github.com/philipwalton","followers_url":"https://api.github.com/users/philipwalton/followers","following_url":"https://api.github.com/users/philipwalton/following{/other_user}","gists_url":"https://api.github.com/users/philipwalton/gists{/gist_id}","starred_url":"https://api.github.com/users/philipwalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipwalton/subscriptions","organizations_url":"https://api.github.com/users/philipwalton/orgs","repos_url":"https://api.github.com/users/philipwalton/repos","events_url":"https://api.github.com/users/philipwalton/events{/privacy}","received_events_url":"https://api.github.com/users/philipwalton/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/google/WebFundamentals/pulls/3134/commits","review_comments_url":"https://api.github.com/repos/google/WebFundamentals/pulls/3134/comments","review_comment_url":"https://api.github.com/repos/google/WebFundamentals/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/WebFundamentals/issues/3134/comments","statuses_url":"https://api.github.com/repos/google/WebFundamentals/statuses/7cf29d0d8152572d93e71710c5d7e2841c3d8b08","head":{"label":"google:service-worker-cs","ref":"service-worker-cs","sha":"7cf29d0d8152572d93e71710c5d7e2841c3d8b08","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":19249835,"name":"WebFundamentals","full_name":"google/WebFundamentals","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/WebFundamentals","description":"Best practices for modern web development","fork":false,"url":"https://api.github.com/repos/google/WebFundamentals","forks_url":"https://api.github.com/repos/google/WebFundamentals/forks","keys_url":"https://api.github.com/repos/google/WebFundamentals/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/WebFundamentals/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/WebFundamentals/teams","hooks_url":"https://api.github.com/repos/google/WebFundamentals/hooks","issue_events_url":"https://api.github.com/repos/google/WebFundamentals/issues/events{/number}","events_url":"https://api.github.com/repos/google/WebFundamentals/events","assignees_url":"https://api.github.com/repos/google/WebFundamentals/assignees{/user}","branches_url":"https://api.github.com/repos/google/WebFundamentals/branches{/branch}","tags_url":"https://api.github.com/repos/google/WebFundamentals/tags","blobs_url":"https://api.github.com/repos/google/WebFundamentals/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/WebFundamentals/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/WebFundamentals/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/WebFundamentals/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/WebFundamentals/statuses/{sha}","languages_url":"https://api.github.com/repos/google/WebFundamentals/languages","stargazers_url":"https://api.github.com/repos/google/WebFundamentals/stargazers","contributors_url":"https://api.github.com/repos/google/WebFundamentals/contributors","subscribers_url":"https://api.github.com/repos/google/WebFundamentals/subscribers","subscription_url":"https://api.github.com/repos/google/WebFundamentals/subscription","commits_url":"https://api.github.com/repos/google/WebFundamentals/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/WebFundamentals/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/WebFundamentals/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/WebFundamentals/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/WebFundamentals/contents/{+path}","compare_url":"https://api.github.com/repos/google/WebFundamentals/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/WebFundamentals/merges","archive_url":"https://api.github.com/repos/google/WebFundamentals/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/WebFundamentals/downloads","issues_url":"https://api.github.com/repos/google/WebFundamentals/issues{/number}","pulls_url":"https://api.github.com/repos/google/WebFundamentals/pulls{/number}","milestones_url":"https://api.github.com/repos/google/WebFundamentals/milestones{/number}","notifications_url":"https://api.github.com/repos/google/WebFundamentals/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/WebFundamentals/labels{/name}","releases_url":"https://api.github.com/repos/google/WebFundamentals/releases{/id}","deployments_url":"https://api.github.com/repos/google/WebFundamentals/deployments","created_at":"2014-04-28T18:45:45Z","updated_at":"2016-07-25T16:18:15Z","pushed_at":"2016-07-25T16:34:15Z","git_url":"git://github.com/google/WebFundamentals.git","ssh_url":"git@github.com:google/WebFundamentals.git","clone_url":"https://github.com/google/WebFundamentals.git","svn_url":"https://github.com/google/WebFundamentals","homepage":"https://developers.google.com/web/fundamentals","size":1093525,"stargazers_count":6186,"watchers_count":6186,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1155,"mirror_url":null,"open_issues_count":334,"forks":1155,"open_issues":334,"watchers":6186,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"c5e269e367f56a3566161ad0134121c642e92bef","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":19249835,"name":"WebFundamentals","full_name":"google/WebFundamentals","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/WebFundamentals","description":"Best practices for modern web development","fork":false,"url":"https://api.github.com/repos/google/WebFundamentals","forks_url":"https://api.github.com/repos/google/WebFundamentals/forks","keys_url":"https://api.github.com/repos/google/WebFundamentals/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/WebFundamentals/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/WebFundamentals/teams","hooks_url":"https://api.github.com/repos/google/WebFundamentals/hooks","issue_events_url":"https://api.github.com/repos/google/WebFundamentals/issues/events{/number}","events_url":"https://api.github.com/repos/google/WebFundamentals/events","assignees_url":"https://api.github.com/repos/google/WebFundamentals/assignees{/user}","branches_url":"https://api.github.com/repos/google/WebFundamentals/branches{/branch}","tags_url":"https://api.github.com/repos/google/WebFundamentals/tags","blobs_url":"https://api.github.com/repos/google/WebFundamentals/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/WebFundamentals/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/WebFundamentals/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/WebFundamentals/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/WebFundamentals/statuses/{sha}","languages_url":"https://api.github.com/repos/google/WebFundamentals/languages","stargazers_url":"https://api.github.com/repos/google/WebFundamentals/stargazers","contributors_url":"https://api.github.com/repos/google/WebFundamentals/contributors","subscribers_url":"https://api.github.com/repos/google/WebFundamentals/subscribers","subscription_url":"https://api.github.com/repos/google/WebFundamentals/subscription","commits_url":"https://api.github.com/repos/google/WebFundamentals/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/WebFundamentals/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/WebFundamentals/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/WebFundamentals/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/WebFundamentals/contents/{+path}","compare_url":"https://api.github.com/repos/google/WebFundamentals/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/WebFundamentals/merges","archive_url":"https://api.github.com/repos/google/WebFundamentals/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/WebFundamentals/downloads","issues_url":"https://api.github.com/repos/google/WebFundamentals/issues{/number}","pulls_url":"https://api.github.com/repos/google/WebFundamentals/pulls{/number}","milestones_url":"https://api.github.com/repos/google/WebFundamentals/milestones{/number}","notifications_url":"https://api.github.com/repos/google/WebFundamentals/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/WebFundamentals/labels{/name}","releases_url":"https://api.github.com/repos/google/WebFundamentals/releases{/id}","deployments_url":"https://api.github.com/repos/google/WebFundamentals/deployments","created_at":"2014-04-28T18:45:45Z","updated_at":"2016-07-25T16:18:15Z","pushed_at":"2016-07-25T16:34:15Z","git_url":"git://github.com/google/WebFundamentals.git","ssh_url":"git@github.com:google/WebFundamentals.git","clone_url":"https://github.com/google/WebFundamentals.git","svn_url":"https://github.com/google/WebFundamentals","homepage":"https://developers.google.com/web/fundamentals","size":1093525,"stargazers_count":6186,"watchers_count":6186,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1155,"mirror_url":null,"open_issues_count":334,"forks":1155,"open_issues":334,"watchers":6186,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/3134"},"html":{"href":"https://github.com/google/WebFundamentals/pull/3134"},"issue":{"href":"https://api.github.com/repos/google/WebFundamentals/issues/3134"},"comments":{"href":"https://api.github.com/repos/google/WebFundamentals/issues/3134/comments"},"review_comments":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/3134/comments"},"review_comment":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/3134/commits"},"statuses":{"href":"https://api.github.com/repos/google/WebFundamentals/statuses/7cf29d0d8152572d93e71710c5d7e2841c3d8b08"}}}}
{"actor":{"display_login":"jpmedley"}}