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

@videsk/uhistory

v1.0.4

Published

A Javascript library for browsing history for persistent or temporary record

Downloads

5

Readme

uHistory

uHistory is a Javascript library for tracking all browsing history. That means, save all page the user visit, with time in page, datetime and url.

Ex. This works for apps that need get history of user before offer support in realtime.

uHistory is totally compatible with SPA (single-page application).

This is not a replacement to Google Analytics or similars.
Is a complement for track users and get history in realtime during active session.

Ex. User request a new chat -> Get history -> Send to agent

This library can be complemented with a xDebugger!

This library was designed for Videsk™ :)

Features

  • Save all visited page
  • Track time in page
  • Get datetime when page was visited
  • Persistent history in localstorage (optional)
  • Compatible with SPA or AJAX load
  • LZ UTF-16 compression to history
  • Protected access directly from session or local storage

Installation

Via NPM

npm i @videsk/uhistory

or in body

<script src="../uhistory.min.js"></script>

Use minified version in production located in dist/ folder.

How works

Not persistent history (only during session)

const history = new uHistory({});
history.init();

Persistent history (localStorage)

const history = new uHistory({ persistent: true });
history.init();

Get history

For get all history only need execute:

history.get();

// Output
// { history: Array, ua: String, lang: String }

The output it's composed of the follow keys:

  • history : Array with all visited pages
  • ua : String with User-Agent
  • lang : String with the main language of browser

Schema of history

{
    history: [
        {
            url: 'https://example.com/post/12345', // Page visited
            time: 12345, // Time in page in milliseconds
            date: 1568777632096 // Timestamp when page is loaded
        }
    ]
}

Stop to tracking

For stop to tracking only need execute history.stop();. This clean all data in store and stop all intervals.

Custom key for store

If you want save data with other key in local or session storage only need set before to initialize.

const history = new uHistory({ key: 'my-custom-key' });
history.init();

Copyrights

This library is totally open source with Apache 2.0 license, but was designed for Videsk™ products.