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

rum-diary-js-client

v0.0.4

Published

rum-diary javascript client - Capture RUM: timers, events, navigation timing, resource timing.

Downloads

8

Readme

rum-diary-js-client

Build Status

rum-diary compatible JavaScript client - Capture RUM: timers, events, navigation timing, resource timing.

Installation

Bower

The easiest way to install rum-diary-js-client is through bower.

  1. bower install rum-diary-js-client
  2. Add a script to your HTML
<script src="bower_components/rum-diary-js-client/dist/rum-diary-js-client.js" defer async></script>

Minified resources can also be used:

<script src="bower_components/rum-diary-js-client/dist/rum-diary-js-client.min.js" defer async></script>

Clone the git repo

If bower isn't your thing, it is easy to do things the old fashioned way.

  1. git clone https://github.com/shane-tomlinson/rum-diary-js-client.git
  2. Copy rum-diary-js-client/dist/rum-diary-js-client.js to a location of your choice.
  3. Add a script tag to the copied file from step 2.

Configuration

The client is configured through data- attributes on the script element.

data-autoinit

If data-autoinit is set to false, automatic initialization will not occur and the client must be manually initialized. See Advanced use

Defaults to true

data-tags

Comma separated list of tags to send to the server. Useful when performing experiments to tag a data set as belonging to a certain class.

Defaults to empty.

data-load_url

URL where to send "load" data. "Load" data is data that is available at the time of window.onload. This includes navigationTiming data, referrer, and whether the user is a returning user.

Defaults to https://rum-diary.org/metrics

  • data-unload_url URL where to send "unload" data. "Unload" data is data that is available at the time of window.onunload. This includes events, timers, and page view duration.

Defaults to https://rum-diary.org/metrics

Advanced use

Manual use

Manual use is normally only needed for access to the events and timers functionality.

First, set data-autoinit to false in the script tag.

<script src="/bower_components/rum-diary-js-client/dist/rum-diary-js-client.js" data-autoinit="false" defer async></script>

Get a reference to the JS client. For more on how, see below. Once a reference is obtained, instantiate a client instance.

var client = new RumDiaryJSClient();
client.init({
  tags: 'experiment1266',
  loadUrl: '/my_stats_collector',
  unloadUrl: '/my_stats_collector'
});

Obtain a reference to the client

Use without a module loader

If used without a module loader, the client is accessible via window.RumDiaryJSClient.

With Requirejs

Rum-diary-js-client is AMD ready and can be used like any other AMD module.

With Browserify

Rum-diary-js-client is UMD ready and can be used with Browserify.

Client API

getLoad

Get data avaialble at window.load

sendLoad

Send data available at window.load to the loadUrl specified in init.

getUnload

Get data avaialble at window.unload. This includes events, timers, and duration.

sendUnload

Send data available at window.unload to the unloadUrl specified in init.

logEvent

Log an event.

client.logEvent('my-event');

startTimer

Start a timer.

client.startTimer('my-timer');

stopTimer

Stop a timer.

client.stopTimer('my-timer');

Get Involved:

Author:

License:

This software is available under version 2.0 of the MPL:

https://www.mozilla.org/MPL/