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

@quatrecentquatre/track-me

v3.0.0

Published

Library that let you easily track events with custom data. ---

Readme

TrackMe

Easily push events to Google Tag Manager for both GA4 and UA properties.

Installation

First of all, you must allow your project to download the package.

To do so, make sure you have a .npmrc file (at the same level as the package.json file) containing the following code:

//registry.npmjs.org/:_authToken=${NPM_TOKEN}

Replace ${NPM_TOKEN} by the token you will find in Zoho behind NPM - Clé installation package.

Then, add the package to your project:

$ yarn add @quatrecentquatre/track-me

Usage

First, make sure to compile the dist/track-me.min.js file with your task runner.

Then, you're already good to go and push your first event!

Pushing events automatically on click

TrackMe listens to all DOM elements with the me:track:click attribute.

Each element with that attribute must have a me:track:data attribute and accepts an optional me:track:ua-data attribute.

me:track:data will contain the data for GA4 property whereas me:track:ua-data will contain the data for UA property if you have to track events in UA property too.

me:track:data must contain a JSON object which looks like the following:

{
    "event": "<event_name>",
    "<additonal_param_1>": "<additional_param_1_value>",
    "<additonal_param_2>": "<additional_param_2_value>"
}

event is required and you can pass any additional parameters if you have too.

me:track:ua-data must contain a JSON object which looks like the following:

{
    "event": "<event_name>",
    "action": "<action>",
    "category": "<category>",
    "label": "<label>",
    "value": "<value>",
}

action is required whereas event, category, label and value are optional.

By default, event will be set to TrackMe.

Here is an example:

<a href="#"
    me:track:click
    me:track:data='{"event": "apply", "position": "developer", "location": "toronto"}'
    me:track:ua-data='{"action": "apply", "category": "developer", "label": "toronto"}'
>Apply</a>

Pushing events manually

In your JS files you can push events manually by using the following code:

Me.track.pushEvent(ga4Data, uaData);

ga4Data is required whereas uaData is optional if you do not have to track events in UA property too.

The data structure for both parameters is the same as the one used for events pushed automatically (see JSON above).

Here is an example:

const ga4data = {
    event: "apply",
    position: "developer",
    location: "toronto",
}
const uaData = {
    action: "apply",
    category: "developer",
    label: "toronto",
}
Me.track.pushEvent(ga4Data, uaData);

Setting up GTM

For GA4 tracking, you'll have to create a trigger using the event name pushed and a tag based on the pushed data.

For UA tracking, you'll have to create a trigger using "TrackMe" as the event name (or the one you'll use if not using the default one) and a tag based on the pushed data.

TrackMe functions

Add new click events to track

In case you need to add DOM and that DOM has a me:track:click attribute in it, you'll need to call a function to add click event listeners.

Right after you append new DOM, simply call the addEvents() function of Me.track. You must pass the targeted DOM element for which you want to add events.

Me.track.addEvents($newContent);

Remove tracking of click events

In case you need to remove DOM and that DOM has a me:track:click attribute in it, you'll need to call a function to remove click event listeners.

Right before you remove DOM, simply call the removeEvents() function of Me.track. You must pass the targeted DOM element for which you want to remove events.

Me.track.removeEvents($contentToDelete);