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

autoanalytics

v0.0.6

Published

automatic track all events on a web based on accessibility

Downloads

3

Readme

AUTOANALYTICS

Autoanalytics is a library to automatic track click events on a web based on accessibility that works inside any library or framework like React or Angular.

Installation

npm install autoanalytics

Usage

import { initializeListeners } from 'autoanalytics'

initializeListeners({
  handler: (data) => {
    // Send the info to your favorite service
  },
})

Event info

  • type: Currently it only can be a click, but in the future we are planning to add other events like submit or change
  • name: the accessible name of the element clicked (we don´t always use the actual clicked element but the nearest parent with information)
  • classes: the classes of the element
  • context: the nearest parent with accessible name
  • occurredAt: a date of the moment when the event is performed
  • targetedElement: the actual clicked element by te user

Example

With this DOM:

<div class="player-controls" aria-label="Player controls">
   <div class="player-controls__buttons">
      <button class="player-controls__play" aria-label="Play">
         <svg class="play__icon"></svg>
      </button>
   </div>
</div>

if you click the svg element you will we the next event info

{
    "type": "click",
    "name": "Play",
    "classes": [
        "player-controls__play"
    ],
    "context": "Player controls",
    "occurredAt": "2022-05-17T00:00:00.000Z",
    "targetedElement": {
        "classes": [
            "play__icon"
        ],
        "tag": "svg"
    }
}

Philosophy

We are using accessibility roles to make our tests using Wrapito and Testing Library this library adds even more value to take into account accessibility into our applications.

As we are using accessibility role this tool may not be the best if you have translations in your app because it will generate different logs for the same action.

This app is not made to use in public pages but in internal tools as it does not protects any data.

About extra properties like current path or url: this library tries to be agnostic of the application details, as it´s just a callback, if you want to extend the current properties you can just add them before send them to you analytics service.