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

cdp-events-tracker

v1.3.9

Published

cdp-events-tracker is a lightweight TypeScript library that collects and sends user interaction data to your Customer Data Platform (CDP). It supports event queuing, batching, and Beacon API for optimal delivery

Downloads

111

Readme

CDP Events Tracker

A lightweight, extensible client-side library for tracking custom user events (such as signups, purchases, and newsletter interactions) and sending them to Customer Data Platform (CDP).


📦 Installation

npm install cdp-events-tracker

import { 
  CDPEventsTracker, 
  EnvironmentType,
  PageActionPoint,
  CustomEvents,
  EventType, 
  PageMetadata,
} from "cdp-events-tracker";

const sessionManager = new CDPEventsTracker(
  "NATION_AFRICA",
  EnvironmentType.production,
  "https://example.com/",
  "api-key",
  {
    articleId: '5095576',
    articleTitle: 'Uniting Kenya through sport: Faith Kipyegon chases history in Nike-backed record bid',
    articleTags: 'Prime, Sports, Divert Me, Inspire Me',
    authors: 'Elias Makori',
    articlePublishDate: '2025-06-26T06:40:37Z',
    articleThumbNail: 'https://example.com/resource/image/4737986/landscape_ratio3x2/1200/800/5c291d8180f5b8831d9609197bcecd01/GM/kipyegon.jpg',
    site: 'Nation',
    rootTitle: 'Kenya',
    premium: true,
    isPuzzlesPage: false,
    pageTitle: 'Athletics',
}
);

tracker.dispatchEvent(PageActionPoint.newSubscriptionPurchase, {
  purchase_id: "c1aab9d7-9b14-48da-9ff3-89cdffc6f47a",
  purchase_date: "2025-06-26T06:40:37Z",
  expiry_date: "2025-06-30T06:40:37Z",
  amount_paid: 1500,
  package_type: "ANNUAL",
  payment_option: "dpo",
  recurrent: true,
});

Supported Events via HTML attributes

The event tracker captures additional events through custom data attributes applied to target elements. To enable tracking, add attributes like the following to the relevant elements:

data-cdp-role="navbar_subscribe-btn"  
data-cdp-event="navbar_subscribe_btn_click"

<-- Below is an example -->
  <a
    href="https://example.com/subscribe"
    type="button"
    class="default-btn sm color-set-color-2 hidden"
    id="account-menu_subscribe-btn"
    data-cdp-role="navbar_subscribe-btn"
    data-cdp-event="navbar_subscribe_btn_click"
  >
    Subscribe
  </a>

Below is a sample of the attributes you should impelement in the target elements within the website

  data-cdp-role="article_author-profile-link"
  data-cdp-role="paywall_subscribe-btn"
  data-cdp-role="navbar_search-btn"
  data-cdp-role="navbar_signin-btn"
  data-cdp-role="navbar_subscribe-btn"
  data-cdp-role="article_newsletter-subscribe-form"
  data-cdp-role="universal_ad-wrapper"
  data-cdp-role="universal_ad-script"