{"_id":"appmetrics.js","_rev":"16-6c14204fa96ef5d9d4efff7124022363","name":"appmetrics.js","description":"Record and report your web app's performance metrics to Google Analytics","dist-tags":{"latest":"0.0.9"},"versions":{"0.0.1":{"name":"appmetrics.js","description":"Record and report your web app's performance metrics to Google Analytics","version":"0.0.1","engines":{"node":">=6.0.0"},"main":"./src/appmetrics.js","scripts":{"postinstall":"gulp","lint":"gulp lint","test":"./node_modules/mocha/bin/mocha"},"repository":{"type":"git","url":"git+https://github.com/ebidel/appmetrics.git"},"bugs":{"url":"https://github.com/ebidel/appmetrics/issues"},"devDependencies":{"babel-core":"^6.13.2","babel-preset-es2015":"^6.13.2","chai":"^3.5.0","del":"^2.2.1","eslint-config-google":"^0.6.0","gulp":"^3.9.1","gulp-closure-compiler":"^0.4.0","gulp-eslint":"^3.0.1","gulp-license":"^1.1.0","gulp-load-plugins":"^1.2.4","gulp-mocha":"^3.0.0","gulp-rename":"^1.2.2","mocha":"^3.0.1","run-sequence":"^1.2.2"},"gitHead":"d0319a1cd260d5c67dcbc378290e4ccb820ab37a","homepage":"https://github.com/ebidel/appmetrics#readme","_id":"appmetrics.js@0.0.1","_shasum":"9815bb85ad6080fa8484ffc46c3f2d92686fbc09","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"ebidel","email":"ebidel@gmail.com"},"dist":{"shasum":"9815bb85ad6080fa8484ffc46c3f2d92686fbc09","tarball":"https://registry.npmjs.org/appmetrics.js/-/appmetrics.js-0.0.1.tgz","integrity":"sha512-Ziz4G71NQFdAKS7sOathVo0bx3dgXJCAwjyZImGI0Xp+P7dCdMUW46cGDBu30qVb5QuH/T+3u2iBj9/JtHXHFw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDDavaybUA83LQBM6/sQRsCdD4zJjHXQsyht3ZK+cMsQIgOs+2TTOtL7lFfrcGpyYn0gGf8BRh4VI56C7uNobx5Rk="}]},"maintainers":[{"name":"ebidel","email":"ebidel@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/appmetrics.js-0.0.1.tgz_1473184437514_0.9952353693079203"}},"0.0.2":{"name":"appmetrics.js","description":"Record and report your web app's performance metrics to Google Analytics","version":"0.0.2","engines":{"node":">=6.0.0"},"main":"./src/appmetrics.js","scripts":{"postinstall":"gulp","lint":"gulp lint","test":"./node_modules/mocha/bin/mocha"},"repository":{"type":"git","url":"git+https://github.com/ebidel/appmetrics.git"},"bugs":{"url":"https://github.com/ebidel/appmetrics/issues"},"devDependencies":{"babel-core":"^6.13.2","babel-preset-es2015":"^6.13.2","chai":"^3.5.0","del":"^2.2.1","eslint-config-google":"^0.6.0","gulp":"^3.9.1","gulp-closure-compiler":"^0.4.0","gulp-eslint":"^3.0.1","gulp-license":"^1.1.0","gulp-load-plugins":"^1.2.4","gulp-mocha":"^3.0.0","gulp-rename":"^1.2.2","mocha":"^3.0.1","run-sequence":"^1.2.2"},"gitHead":"875d794f6e41b42015b900db5c4d7481f55050e8","homepage":"https://github.com/ebidel/appmetrics#readme","_id":"appmetrics.js@0.0.2","_shasum":"01b0f79f28cb7fd7947849ecc20db516223e2516","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"ebidel","email":"ebidel@gmail.com"},"dist":{"shasum":"01b0f79f28cb7fd7947849ecc20db516223e2516","tarball":"https://registry.npmjs.org/appmetrics.js/-/appmetrics.js-0.0.2.tgz","integrity":"sha512-GdsH97/1DTDmPITZC8chtrDHgGouM6QgqECcGZDwk/4UvFQ6aTLAK2H+Ne8CXOh457uClDBLj0MrYVmhfHAllw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDp8+WArfEEzQDvcIlFDgT91ltf4yrtK5mo5jHXNNf/3AiEA/CKPnJu13DlWvz4IbFsgg84xIlvb072EOK0QjFNbkH8="}]},"maintainers":[{"name":"ebidel","email":"ebidel@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/appmetrics.js-0.0.2.tgz_1473185327854_0.40616954350844026"}},"0.0.3":{"name":"appmetrics.js","description":"Record and report your web app's performance metrics to Google Analytics","version":"0.0.3","engines":{"node":">=6.0.0"},"main":"./src/appmetrics.js","scripts":{"postinstall":"./node_modules/gulp/bin/gulp.js","lint":"gulp lint","test":"./node_modules/mocha/bin/mocha"},"repository":{"type":"git","url":"git+https://github.com/ebidel/appmetrics.git"},"bugs":{"url":"https://github.com/ebidel/appmetrics/issues"},"devDependencies":{"babel-core":"^6.13.2","babel-preset-es2015":"^6.13.2","chai":"^3.5.0","del":"^2.2.1","eslint-config-google":"^0.6.0","gulp":"^3.9.1","gulp-closure-compiler":"^0.4.0","gulp-eslint":"^3.0.1","gulp-license":"^1.1.0","gulp-load-plugins":"^1.2.4","gulp-mocha":"^3.0.0","gulp-rename":"^1.2.2","mocha":"^3.0.1","run-sequence":"^1.2.2"},"gitHead":"1c619327cccc36f6b9de98e7af4648324a209a57","homepage":"https://github.com/ebidel/appmetrics#readme","_id":"appmetrics.js@0.0.3","_shasum":"bb4c8fd87d6d4212a013c832dbb99a703feab619","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"ebidel","email":"ebidel@gmail.com"},"dist":{"shasum":"bb4c8fd87d6d4212a013c832dbb99a703feab619","tarball":"https://registry.npmjs.org/appmetrics.js/-/appmetrics.js-0.0.3.tgz","integrity":"sha512-nZE6JXlmczCsTQvKp7lMuqKum5UXG8um2xhGlKzhEO2t34C6pca1PkxTCmKtPFtth92ot2SfrLsFgO6Jkh2/Hw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHm43OHpveURsft3c763cpI7ZVEVPs2Cv4tY6TxQIKqUAiBJJ9S+tW7BctrOWbuWE4+6JOkpp8tKdRHevQqkPa4fQw=="}]},"maintainers":[{"name":"ebidel","email":"ebidel@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/appmetrics.js-0.0.3.tgz_1473185448793_0.7375766427721828"}},"0.0.4":{"name":"appmetrics.js","description":"Record and report your web app's performance metrics to Google Analytics","version":"0.0.4","license":"Apache-2.0","engines":{"node":">=6.0.0"},"main":"./src/appmetrics.js","keywords":["metrics","analytics","reporting","measure","measurement","instrument"],"scripts":{"lint":"gulp lint","test":"./node_modules/mocha/bin/mocha"},"repository":{"type":"git","url":"git+https://github.com/ebidel/appmetrics.js.git"},"bugs":{"url":"https://github.com/ebidel/appmetrics.js/issues"},"devDependencies":{"babel-core":"^6.13.2","babel-preset-es2015":"^6.13.2","chai":"^3.5.0","del":"^2.2.1","eslint-config-google":"^0.6.0","gulp":"^3.9.1","gulp-closure-compiler":"^0.4.0","gulp-eslint":"^3.0.1","gulp-license":"^1.1.0","gulp-load-plugins":"^1.2.4","gulp-mocha":"^3.0.0","gulp-rename":"^1.2.2","mocha":"^3.0.1","run-sequence":"^1.2.2"},"gitHead":"1a3b3fdabf8e5520a28b856d9873dd2c8248edb3","homepage":"https://github.com/ebidel/appmetrics.js#readme","_id":"appmetrics.js@0.0.4","_shasum":"1c1e098d8e9773081ed45d4beba1906534495d53","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"ebidel","email":"ebidel@gmail.com"},"dist":{"shasum":"1c1e098d8e9773081ed45d4beba1906534495d53","tarball":"https://registry.npmjs.org/appmetrics.js/-/appmetrics.js-0.0.4.tgz","integrity":"sha512-5TVaYODJ/Nl7wd6vV4EuX2EGNr5A3Fcx/ckCvxuSUpNvf99ppVke6I0g5sqsGZWUAbZGxXmmok0yOoqxnjf2pQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFL9psfAel1C53fErG+W7Qq4QW+1XtMoYX7wFvoNvL1kAiAQ3SDkjeJ2GutFZBYCSmL1DUcmYLBcn3n/+PaFRPcI+A=="}]},"maintainers":[{"name":"ebidel","email":"ebidel@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/appmetrics.js-0.0.4.tgz_1473185682433_0.46572780422866344"}},"0.0.5":{"name":"appmetrics.js","description":"Record and report your web app's performance metrics to Google Analytics","version":"0.0.5","license":"Apache-2.0","engines":{"node":">=6.0.0"},"main":"./src/appmetrics.js","keywords":["metrics","analytics","reporting","measure","measurement","instrument"],"scripts":{"lint":"gulp lint","test":"./node_modules/mocha/bin/mocha","release":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/ebidel/appmetrics.js.git"},"bugs":{"url":"https://github.com/ebidel/appmetrics.js/issues"},"devDependencies":{"babel-core":"^6.13.2","babel-preset-es2015":"^6.13.2","chai":"^3.5.0","del":"^2.2.1","eslint-config-google":"^0.6.0","gulp":"^3.9.1","gulp-closure-compiler":"^0.4.0","gulp-eslint":"^3.0.1","gulp-inject-version":"^1.0.1","gulp-license":"^1.1.0","gulp-load-plugins":"^1.2.4","gulp-mocha":"^3.0.0","gulp-rename":"^1.2.2","mocha":"^3.0.1","run-sequence":"^1.2.2"},"gitHead":"78775c77b9165eeeb3d95d0b81089a1f45e3c019","homepage":"https://github.com/ebidel/appmetrics.js#readme","_id":"appmetrics.js@0.0.5","_shasum":"62eaac5b684cef9aca19c700b384d47761632bf2","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"ebidel","email":"ebidel@gmail.com"},"dist":{"shasum":"62eaac5b684cef9aca19c700b384d47761632bf2","tarball":"https://registry.npmjs.org/appmetrics.js/-/appmetrics.js-0.0.5.tgz","integrity":"sha512-zYEKjwazGP/wOYKFrg9iS/lW+MFmdqJnzHdGQpcpSjmCyK9TQ0JTd6gcpgoy/tiRGtLX8QyR4be/4B3605gQDQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQsE6HxfDUagnBUXymbBzzjZy0j9DzQXkED8NXKdnaUQIhAOAJMAT2oru0IPcqXJiOLlE4jvhkalVdQjHDuW3f7Wgc"}]},"maintainers":[{"name":"ebidel","email":"ebidel@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/appmetrics.js-0.0.5.tgz_1473186828920_0.9071896499954164"}},"0.0.6":{"name":"appmetrics.js","description":"Record and report your web app's performance metrics to Google Analytics","version":"0.0.6","license":"Apache-2.0","engines":{"node":">=6.0.0"},"main":"./src/appmetrics.js","keywords":["metrics","analytics","reporting","measure","measurement","instrument"],"scripts":{"lint":"gulp lint","test":"./node_modules/mocha/bin/mocha","release":"npm version patch; gulp; npm publish"},"repository":{"type":"git","url":"git+https://github.com/ebidel/appmetrics.js.git"},"bugs":{"url":"https://github.com/ebidel/appmetrics.js/issues"},"devDependencies":{"babel-core":"^6.13.2","babel-preset-es2015":"^6.13.2","chai":"^3.5.0","del":"^2.2.1","eslint-config-google":"^0.6.0","gulp":"^3.9.1","gulp-closure-compiler":"^0.4.0","gulp-eslint":"^3.0.1","gulp-inject-version":"^1.0.1","gulp-license":"^1.1.0","gulp-load-plugins":"^1.2.4","gulp-mocha":"^3.0.0","gulp-rename":"^1.2.2","mocha":"^3.0.1","run-sequence":"^1.2.2"},"gitHead":"06dd0150ce4d9e609c1181d4429214791dda421a","homepage":"https://github.com/ebidel/appmetrics.js#readme","_id":"appmetrics.js@0.0.6","_shasum":"5e8be44cb7c0e29daf0bea3bf2e2bfe82ff23d3b","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.5.0","_npmUser":{"name":"ebidel","email":"ebidel@gmail.com"},"dist":{"shasum":"5e8be44cb7c0e29daf0bea3bf2e2bfe82ff23d3b","tarball":"https://registry.npmjs.org/appmetrics.js/-/appmetrics.js-0.0.6.tgz","integrity":"sha512-G7vvxDAzypGsf9cpOCmuaBLQdwAXt8nF8U89GgJVDqqiE+hAv9oJQ4cL7lqOjHoK8Niwimz1YxogeL7dgtMK4g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGnzIUkBpTtHX3DI0FJFY/VDlF0Jp/Ecv+0BjX0qeD30AiEAkSCYr5uxzNBxEuznAvHSFT9oD+MyLzqOxEBcLK/JTNA="}]},"maintainers":[{"name":"ebidel","email":"ebidel@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/appmetrics.js-0.0.6.tgz_1473635489243_0.26130037009716034"}},"0.0.7":{"name":"appmetrics.js","description":"Record and report your web app's performance metrics to Google Analytics","version":"0.0.7","license":"Apache-2.0","engines":{"node":">=6.0.0"},"main":"./src/appmetrics.js","keywords":["metrics","analytics","reporting","measure","measurement","instrument"],"scripts":{"lint":"gulp lint","test":"./node_modules/mocha/bin/mocha","release":"npm version patch; gulp; npm publish"},"repository":{"type":"git","url":"git+https://github.com/ebidel/appmetrics.js.git"},"bugs":{"url":"https://github.com/ebidel/appmetrics.js/issues"},"devDependencies":{"babel-core":"^6.13.2","babel-preset-es2015":"^6.13.2","chai":"^3.5.0","del":"^2.2.1","eslint-config-google":"^0.6.0","gulp":"^3.9.1","gulp-closure-compiler":"^0.4.0","gulp-eslint":"^3.0.1","gulp-inject-version":"^1.0.1","gulp-license":"^1.1.0","gulp-load-plugins":"^1.2.4","gulp-mocha":"^3.0.0","gulp-rename":"^1.2.2","mocha":"^3.0.1","run-sequence":"^1.2.2"},"gitHead":"43dd88391efe5f71b47a14a03454902d11a046c3","homepage":"https://github.com/ebidel/appmetrics.js#readme","_id":"appmetrics.js@0.0.7","_shasum":"7c3ae19daf77065dd2354b7691a8e43bd69d94a6","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"ebidel","email":"ebidel@gmail.com"},"dist":{"shasum":"7c3ae19daf77065dd2354b7691a8e43bd69d94a6","tarball":"https://registry.npmjs.org/appmetrics.js/-/appmetrics.js-0.0.7.tgz","integrity":"sha512-yDulIgxVidpzFuIxQ9YWvpDpUjoG4okoL0bcsnZOtgi4+3Um99x6enwOGikXwWPlEvkBemP9Nhf6mbick3eljw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNJ/opuwj4UKrRRw+7r2zkgmiZ7yfrhksrRoQ34agTAgIhANeX+l0rkyggetJXaUchXfJn3N12nBHfvsE/HvQ3iZMh"}]},"maintainers":[{"name":"ebidel","email":"ebidel@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/appmetrics.js-0.0.7.tgz_1486670619710_0.25360103393904865"}},"0.0.8":{"name":"appmetrics.js","description":"Record and report your web app's performance metrics to Google Analytics","version":"0.0.8","license":"Apache-2.0","engines":{"node":">=6.0.0"},"main":"./dist/appmetrics.min.js","keywords":["metrics","analytics","reporting","measure","measurement","instrument"],"scripts":{"lint":"gulp lint","test":"./node_modules/mocha/bin/mocha","release":"npm version patch; gulp; npm publish"},"repository":{"type":"git","url":"git+https://github.com/ebidel/appmetrics.js.git"},"bugs":{"url":"https://github.com/ebidel/appmetrics.js/issues"},"devDependencies":{"babel-core":"^6.13.2","babel-preset-es2015":"^6.13.2","chai":"^3.5.0","del":"^2.2.1","eslint-config-google":"^0.6.0","gulp":"^3.9.1","gulp-closure-compiler":"^0.4.0","gulp-eslint":"^3.0.1","gulp-inject-version":"^1.0.1","gulp-license":"^1.1.0","gulp-load-plugins":"^1.2.4","gulp-mocha":"^3.0.0","gulp-rename":"^1.2.2","mocha":"^3.0.1","run-sequence":"^1.2.2"},"gitHead":"97cb400d223a48753b31ed36cde69135fd6b7f49","homepage":"https://github.com/ebidel/appmetrics.js#readme","_id":"appmetrics.js@0.0.8","_npmVersion":"5.0.4","_nodeVersion":"8.1.2","_npmUser":{"name":"ebidel","email":"ebidel@gmail.com"},"dist":{"integrity":"sha512-89CLIt3WCgWmexLGSG9ACT8e3JO9PiMkYF3J80XRCpQsSSQOz+BKZXs9y/aevnILL4/UiPjgu9i1SCnNlvLH3A==","shasum":"b2b25cf5b794ee84a4e383b44ebaf456647c1a80","tarball":"https://registry.npmjs.org/appmetrics.js/-/appmetrics.js-0.0.8.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDb2SV2gm1nWogykytzsxBu2BHRKthVx/AeicAT4EaqfgIgZscmQMa4cjw22vH6USEfFXYCBQsrywmsqO8t25xAKe4="}]},"maintainers":[{"name":"ebidel","email":"ebidel@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/appmetrics.js-0.0.8.tgz_1498768031841_0.93451934796758"}},"0.0.9":{"name":"appmetrics.js","description":"Record and report your web app's performance metrics to Google Analytics","version":"0.0.9","license":"Apache-2.0","engines":{"node":">=6.0.0"},"main":"./dist/appmetrics.min.js","keywords":["metrics","analytics","reporting","measure","measurement","instrument"],"scripts":{"lint":"gulp lint","test":"./node_modules/mocha/bin/mocha","release":"npm version patch; gulp; npm publish"},"repository":{"type":"git","url":"git+https://github.com/ebidel/appmetrics.js.git"},"bugs":{"url":"https://github.com/ebidel/appmetrics.js/issues"},"devDependencies":{"babel-core":"^6.13.2","babel-preset-es2015":"^6.13.2","chai":"^3.5.0","del":"^2.2.1","eslint-config-google":"^0.6.0","gulp":"^3.9.1","gulp-closure-compiler":"^0.4.0","gulp-eslint":"^3.0.1","gulp-inject-version":"^1.0.1","gulp-license":"^1.1.0","gulp-load-plugins":"^1.2.4","gulp-mocha":"^3.0.0","gulp-rename":"^1.2.2","mocha":"^3.0.1","run-sequence":"^1.2.2"},"gitHead":"cde150642cd689711356b3ce31d05c2a187bfc41","homepage":"https://github.com/ebidel/appmetrics.js#readme","_id":"appmetrics.js@0.0.9","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"ebidel","email":"ebidel@gmail.com"},"dist":{"integrity":"sha512-zoz7GVIVAewx6ExdTbYluh79CW5+UPHBiFEfvICjbgzVTqV3CLV2BHlPoDEuQtyjjtnw1WYwWqv/CJy2dylczQ==","shasum":"71c317f3ce64827fe8d1cc1fe79a93cc06cab6cf","tarball":"https://registry.npmjs.org/appmetrics.js/-/appmetrics.js-0.0.9.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDvqDRtFjx/A3sEUafH3r/G/K1DNw1Wo6tUhchJf1o00AIhALyzj74lea7/DYSnV476QwU9951HB/spCWGBtjJ/XdsM"}]},"maintainers":[{"name":"ebidel","email":"ebidel@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/appmetrics.js-0.0.9.tgz_1503551214169_0.7684207712300122"}}},"readme":"## appmetrics.js\n\n> A small (803 bytes gzipped) library for measuring things in your web app, annotating the DevTools timeline, and reporting the results to Google Analytics.\n\nThis library is a small wrapper around the the [User Timing API](https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API). It makes it easier to use. appmetrics.js allows you to instrument your app, record performance metrics, and (optionally) report those metrics to [Google Analytics](https://analytics.google.com). Over time, you'll be able to track the performance of your web app!\n\n### What does it do?\n\nIf you want to measure the performance of certain events in your web app. How long did that take?\n\nIn browsers that support the full [User Timing API](https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API), this library integrates with DevTools. App measurements in the timeline:\n\n[![User timing inputs show up in the DevTools timeline](https://s16.postimg.org/bm2owyvqd/Screen_Shot_2016_08_23_at_6_03_30_PM.png)](https://postimg.org/image/icj66eiw1/)\n\nMarks you create will also show up in [webpagetest.org](https://www.webpagetest.org/) results:\n\n[![Screen Shot 2016-08-23 at 6.22.37 PM.png](https://s16.postimg.org/rxa0gsuxx/Screen_Shot_2016_08_23_at_6_22_37_PM.png)](https://postimg.org/image/6nme5yen5/)\n\nIf you chose to send metrics to Google Analytics, values will show up its UI. See below.\n\n### Installing\n\nBower:\n\n    bower install --save-dev ebidel/appmetrics.js\n\nnpm (https://www.npmjs.com/package/appmetrics.js):\n\n    npm install --save-dev appmetrics.js\n\n### Usage\n\nDrop one of these on your page:\n\n```html\n<script src=\"bower_components/appmetrics.js/dist/appmetrics.min.js\"></script>\n  or\n<script src=\"node_modules/appmetrics.js/dist/appmetrics.min.js\"></script>\n```\n\nTo measure how long something takes in your app, first create a new metric:\n\n```js\nlet metric = new Metric('my_event'); // each metric name should be unique.\n```\n\nSpecify the beginning of your event by calling `start()`. This adds a mark in the DevTools timeline:\n\n```js\nmetric.start(); // mark name will be \"mark_my_event_start\"\n```\n\nWhen the event completes, call `end()`. This adds another mark in the DevTools timeline\nand measures the duration:\n\n```js\nmetric.end(); // mark name will be \"mark_my_event_end\".\nconsole.log(`${metric.name} took ${metric.duration} ms`);\nmetric.log(); // Helper for logging the metric info to the console.\n```\n\nFrom here, you can examine performance of your measurements in the console:\n\n[![Logging records to the console](https://s4.postimg.org/b47jz5699/Screen_Shot_2016_08_23_at_6_08_26_PM.png)](https://postimg.org/image/h558w7svd/)\n\nOr view the records in the DevTools Timeline under \"Input\" (see screen shot above).\n\n### Reporting metrics to Google Analytics (optional)\n\n**Be sure to load the Google Analytics library on your page.**\n\nMetrics can be reported to Google Analytics using `sendToAnalytics(<category>)`. These show up in the Analytics UI under [User Timing](https://developers.google.com/analytics/devguides/collection/analyticsjs/user-timings).\n\n```js\nmetric1.sendToAnalytics('page load');\nmetric2.sendToAnalytics('render', 'first paint'); // Optional 2nd arg is an event name\nmetric3.sendToAnalytics('JS Dependencies', 'load', 1234567890); // Optional 3rd arg to override metric3.duration.\n```\n\nThe first argument to `sendToAnalytics()` is the category of your metric ('load', 'gallery', 'video'). The second argument is an optional name of the metric ('first paint', 'reveal', 'watch_started').  By default, `metric.name` is used, but oftentimes it's more convenient to send a shorter to Google Analytics so it renders it nicely in its UI.\n\nValues sent to Analytics will show up in its UI under **Behavior > Site Speed > User Timings**:\n\n[![Screen Shot 2016-08-23 at 6.40.03 PM.png](https://s3.postimg.org/6y0ay534j/Screen_Shot_2016_08_23_at_6_40_03_PM.png)](https://postimg.org/image/6l8wrykun/)\n\n### Examples\n\nExample - measure how long it takes a json file to load, and report it to Google Analytics:\n\n```html\n<script>\n  const metric = new Metric('features_loaded');\n  metric.start();\n\n  function onFeaturesLoad() {\n    metric.end().log().sendToAnalytics('features', 'loaded');\n  }\n</script>\n<script src=\"features.json\" onload=\"onFeaturesLoad()\"></script>\n```\n\nExample - report the first paint to Google Analytics.\n\n```js\n/**\n * Returns the browser's first paint metric (if available).\n * @return {number} The first paint time in ms.\n */\nfunction getFirstPaintIfSupported() {\n  if (window.chrome && window.chrome.loadTimes) {\n    const load = window.chrome.loadTimes();\n    const fp = (load.firstPaintTime - load.startLoadTime) * 1000;\n    return Math.round(fp);\n  } else if ('performance' in window) {\n    const navTiming = window.performance.timing;\n    // See http://msdn.microsoft.com/ff974719\n    if (navTiming && navTiming.msFirstPaint && navTiming.navigationStart !== 0) {\n      // See http://msdn.microsoft.com/ff974719\n      return navTiming.msFirstPaint - navTiming.navigationStart;\n    }\n  }\n  return null;\n}\n\n// Take measurement after page load.\nwindow.addEventListener('load', function() {\n  const fp = getFirstPaintIfSupported();\n  if (fp) {\n    const metric = new Metric('firstpaint');\n\n    // No need to call start()/end(). Can send a value, directly.\n    metric.sendToAnalytics('load', metric.name, fp);\n  }\n});\n```\n\n### Browser support\n\nAny browser that supports `performance.now()`! That's  all the modern stuff: Chrome, Firefox, Safari 9.2+, Edge, IE 10, Android Browser 4.4, UC Browser.\n\n**Caveat**: In Safari, the [User Timing API](http://caniuse.com/#feat=user-timing) (`performance.mark()`) is not available, so the DevTools timeline will not be annotated with marks.\n\nSee [caniuse.com](http://caniuse.com/#feat=high-resolution-time) for full support.\n\n### Tips\n\nAll methods can be chained for easier use:\n\n    metric.start();\n    // ... some time later ...\n    metric.end().log().sendToAnalytics('extras', 'syntax highlight');\n\n### Contributing\n\nCheckout and install the dependencies:\n\n    git clone git@github.com:ebidel/appmetrics.js.git\n    cd appmetrics.js\n    npm install\n    gulp\n\n#### Run the tests\n\nStart a web server in the project directory and navigate to http://localhost:3000/test/. If you makes changes to the library, be sure to run `gulp` to rebuild the library in `/dist`.\n\n### License\n\nApache 2. See the LICENSE.\n\n\n","maintainers":[{"name":"ebidel","email":"ebidel@gmail.com"}],"time":{"modified":"2022-06-13T03:19:04.128Z","created":"2016-09-06T17:53:58.594Z","0.0.1":"2016-09-06T17:53:58.594Z","0.0.2":"2016-09-06T18:08:49.431Z","0.0.3":"2016-09-06T18:10:50.367Z","0.0.4":"2016-09-06T18:14:43.477Z","0.0.5":"2016-09-06T18:33:50.728Z","0.0.6":"2016-09-11T23:11:29.470Z","0.0.7":"2017-02-09T20:03:39.927Z","0.0.8":"2017-06-29T20:27:11.952Z","0.0.9":"2017-08-24T05:06:54.269Z"},"homepage":"https://github.com/ebidel/appmetrics.js#readme","repository":{"type":"git","url":"git+https://github.com/ebidel/appmetrics.js.git"},"bugs":{"url":"https://github.com/ebidel/appmetrics.js/issues"},"readmeFilename":"README.md","keywords":["metrics","analytics","reporting","measure","measurement","instrument"],"license":"Apache-2.0","users":{"knksmith57":true,"aaronhans":true,"ecbypi":true,"alexxnica":true}}