npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

frontend-tracker

v0.1.1

Published

Monitoring frontend errors, send error to server automanticly.

Downloads

6

Readme

Frontend Tracker

GitHub version Bower version npm version

Intro to Frontend Tracker

Sending frontend error to server. Get frontend error before Issue created.

Highlight

  1. Get frontend error when occurred
  2. Logging script error
  3. Logging XHR request error
  4. Logging XHR request timeout
  5. Logging XHR slow request
  6. Logging cross origin XHR request
  7. Logging resource loading error
  8. Logging cross origin resource loading
  9. Config URL with regular expression

Installation

Use Bower

bower install frontend-tracker --save

or Use npm

bower install frontend-tracker --save

or directly download the ZIP archive to get frontend-tracker.

then add into the page you want to inspect errors.

<script src="path/to/package/dist/tracker.min.js">

Configuration

Add following code into your html file to start and config Frontend Tracker.

<script type="text/javascript">
  window.setTracker({
    endpoint: '',
    xhr: {
      log: {
        crossOrigin: true,
        slowRequest: true,
        timeout: true,
        error: true
      },
      origin: [
        'http://www.pgyer.com',
        /.*\.tracup\.com/,
      ],
      timeLimit: {
        send: 0,
        load: 0,
        total: 0
      },
      exclude: []
    },
    resource: {
      log: {
        crossOrigin: true,
        error: true
      },
      origin: [],
      exclude: []
    },
    script: {
      log: {
        error: true
      },
      exclude: []
    }
  })
  </script>

Options

endpoint

String
Required

URL or URI to post error message.

xhr

Object
Required

An object to config when XHR error occurred.

| name | type | description | | :-- | :-- | :-- | | log | Required, Object | Object to config log capture | | log.crossOrigin | Required, Boolean, Default: false | Capture XHR cross origin if set to true | | log.slowRequest | Required, Boolean, Default: false | Capture slow request if set to true | | log.timeout | Required, Boolean, Default: false | Capture XHR timeout event if set to true | | log.error | Required, Boolean, Default: false | Capture XHR error event if set to true | | origin | Optional, Array | Set Origin, both Sting and Regular expression accepted | | timeLimit | Optional, Object | A object to describe slow log timing threshold. | | timeLimit.send | int, Default: 0 | XHR sending time threshold. 0 is no limit (ms) | | timeLimit.load | int, Default: 0 | XHR loading time threshold. 0 is no limit (ms) | | timeLimit.total | int, Default: 0 | XHR total request time threshold. 0 is no limit (ms) | | exclude | Optional, Array | Set ignore path, both Sting and Regular expression accepted |

resource

Object
Required

An object to config when resource error occurred.

| name | type | description | | :-- | :-- | :-- | | log | Required, Object | Object to config log capture | | log.crossOrigin | Required, Boolean, Default: false | Capture resource cross origin if set to true | | log.error | Required, Boolean, Default: false | Capture resource error event if set to true | | origin | Optional, Array | Set Origin, both Sting and Regular expression accepted | | exclude | Optional, Array | Set ignore path, both Sting and Regular expression accepted |

script

Object Required

An object to config when script error occurred.

| name | type | description | | :-- | :-- | :-- | | log | Required, Object | Object to config log capture | | log.error | Required, Boolean, Default: false | Capture script error event if set to true | | exclude | Optional, Array | Set ignore filename, both Sting and Regular expression accepted |

Handling Error Message

An error message in JSON format will post to endpoint when errors occurred.

Fields

| name | value | description | | :-- | :-- | :-- | | type | String | Type of error message. one of XHR, RESOURCE, SCRIPT | | data | Object | Detailed error information. | | currentURL | String | URL of target page. | | userAgent | String | User-Agent String of target Browser. |

Error message can be get from data.message. Detail error data can be get via parsing from data.detail field.

| type | Structure of data.detail | description | | :-- | :-- | :-- | | XHR | {request: String, response: {status: int, response: String},timing: {send: int, load: int, total: int}} | request: Request URL, status: status code of xhr, response: response text form xhr, send: sending time of xhr (ms), load: loading time of xhr (ms), total: request time of xhr (ms) | | RESOURCE | {tagname: String, resourceURL: String} | tagname: tagname of element, resourceURL: URL of resource | | SCRIPT | {file: String, line: int, column: int, trace: String} | file: script filename, line: line number of error script, column: column number of error script, trace: stack trace of error |

License

Frontend Tracker is GPL-3 licensed.