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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@edulib-france/yawl

v0.2.0

Published

Simple, powerful JavaScript analytics

Readme

NPM Version

Renovate dashboard

Yawl

Yawl is a simple and powerful JavaScript analytics solution, derived from a fork of ahoy.js by Edulib. It allows you to track visits and other custom events on your website.

Table of Contents

Installation

Via npm

npm install @edulib-france/yawl

From the repository

Clone the repository and install the dependencies:

git clone https://github.com/edulib-france/yawl.git
cd yawl
npm install

Configuration

yawl.configure({ apiKey: 'your_api_key' }) must be called before tracking events. The configuration is asynchronous and returns a Promise. You can also specify the environment using the env property, which defaults to 'prod'.

await yawl.configure({
  apiKey: 'your_api_key',
  env: 'prod', // optional, defaults to 'prod'
});

Usage

After configuration, you can initialize Yawl and track events on your site. For example, in your HTML file:

<!DOCTYPE html>
<html>
  <head>
    <title>Yawl Analytics</title>
    <script src="dist/yawl.js"></script>
    <script>
      // Initialize Yawl with your API key
      (async function() {
        await yawl.configure({
          apiKey: 'your_api_key',
          env: 'prod' // optional, defaults to 'prod'
        });

        // Example of tracking a custom event
        await yawl.track({
          name: 'event_name',
          ean: 12323938432,
          establishment_account_id: '456',
          properties: {
            key: 'value'
          },
          user_type: 'student',
        });
      })();
    </script>
  </head>
  <body>
    <!-- Your HTML content -->
  </body>
</html>

Events

The yawl.track function is used to track custom events on your website. It sends event data to the analytics backend for processing. This is an asynchronous method that returns a Promise.

Here are the parameters for the track event:

| Parameter | Type | Description | | -------------------------- | ------- | ------------------------------------------- | | ean | Integer | The article ID associated with the event. | | establishment_account_id | String | The establishment account ID. | | name | String | The name of the event (e.g., "click"). | | properties | Object | Additional properties related to the event. | | user_type | String | The type of user (e.g., "client", "admin"). |

Example:

await yawl.track({
  name: 'event_name',
  ean: 12323938432,
  establishment_account_id: '456',
  properties: {
    key: 'value',
  },
  user_type: 'student',
});

Views

The yawl.trackView function is used to track page views on your website. It automatically collects common page information like URL, title, and page path, and allows you to add custom properties. This is an asynchronous method that returns a Promise.

Here are the parameters for the trackView:

| Parameter | Type | Description | | -------------------------- | ------- | ----------------------------------------------- | | ean | Integer | The article ID associated with the page view. | | establishment_account_id | String | The establishment account ID. | | properties | Object | Additional properties related to the page view. | | user_type | String | The type of user (e.g., "client", "admin"). |

Example:

// Track a basic page view
await yawl.trackView();

// Track a page view with additional properties
await yawl.trackView({
  ean: 12323938432,
  establishment_account_id: '456',
  properties: {
    key: 'value',
  },
  user_type: 'student',
});

Reset Visit

The yawl.resetVisit function allows you to reset the current visit and visitor tracking session. This is useful when a user logs out of your application, ensuring that their analytics session is properly terminated and prepare for a new one.

Note: The reset includes a 500ms delay to ensure pending events are sent before the session ends. A new visit is automatically created after the reset.

Example:

await yawl.resetVisit();

Development

Build Scripts

The project uses Rollup to generate the bundles (UMD and ES Modules).

Build: Generates the bundles in the dist/ folder.

License

This project is distributed under the MIT license.