~didrocks/+junk/face-detection-15.04

« back to all changes in this revision

Viewing changes to facedetection/www/bower_components/platinum-sw/platinum-sw-offline-analytics.html

  • Committer: Didier Roche
  • Date: 2016-05-10 23:09:11 UTC
  • Revision ID: didier.roche@canonical.com-20160510230911-c7xr490zrj3yrzxd
New version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!--
 
2
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
 
3
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 
4
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 
5
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 
6
Code distributed by Google as part of the polymer project is also
 
7
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 
8
-->
 
9
<link rel="import" href="../polymer/polymer.html">
 
10
 
 
11
<script>
 
12
  /**
 
13
   * The `<platinum-sw-offline-analytics>` element registers a service worker handler to
 
14
   * intercepts requests for Google Analytics pings.
 
15
   *
 
16
   * If the HTTP GET for the ping is successful (because the browser is online), then everything
 
17
   * proceeds as it normally would. If the HTTP GET fails, the ping request is saved to IndexedDB, and each time the service worker
 
18
   * script starts up it will attempt to "replay" those saved ping requests, giving up after one day
 
19
   * has passed.
 
20
   *
 
21
   * The [`qt`](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#qt)
 
22
   * URL parameter is automatically added to the replayed HTTP GET and set to the number of
 
23
   * milliseconds that has passed since the initial ping request was attempted, to ensure that the
 
24
   * original time attribution is correct.
 
25
   *
 
26
   * `<platinum-sw-offline-analytics>` does not take care of setting up Google Analytics on your
 
27
   * page, and assumes that you have [properly configured](https://support.google.com/analytics/answer/1008080)
 
28
   * Google Analytics tracking code registered elsewhere on your page.
 
29
   *
 
30
   * Since `<platinum-sw-offline-analytics>` is only useful if the page that is being tracked with
 
31
   * Google Analytics works offline, it's best used in conjunction with the `<platinum-sw-cache>`
 
32
   * element, which takes care of caching your site's resources and serving them while offline.
 
33
   *
 
34
   * A basic configuration is
 
35
   *
 
36
   *     <platinum-sw-register auto-register>
 
37
   *       <platinum-sw-offline-analytics></platinum-sw-offline-analytics>
 
38
   *       <platinum-sw-cache></platinum-sw-cache>
 
39
   *     </platinum-sw-register>
 
40
   *
 
41
   */
 
42
  Polymer({
 
43
    is: 'platinum-sw-offline-analytics',
 
44
 
 
45
    _getParameters: function(baseURI) {
 
46
      return Promise.resolve({
 
47
        importscript: new URL('bootstrap/simple-db.js', baseURI).href,
 
48
        importscriptLate: [
 
49
          new URL('bootstrap/sw-toolbox-setup.js', baseURI).href,
 
50
          new URL('bootstrap/offline-analytics.js', baseURI).href
 
51
        ]
 
52
      });
 
53
    }
 
54
  });
 
55
</script>