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

@cxsense/analytics

v1.0.3

Published

Analytics is a client web SDK that collects customer interactions and listens to your customer journey updates.

Readme

CxSense Analytics

Analytics is a client web SDK that collects customer interactions and listens to your customer journey updates.

CxSense empowers engineers to build personalised and hyper-personalised customer expriences in days instead of month. Sign up with CxSense today.

Before you start

This guide assumes you have created a free project account on CxSense. If you don't already have an account you can start by creating a free account and registering a web app to access your api_key.

Getting started

Using the Analytics package is as simple as adding this JavaScript code to your page.

import analytics from '@cxsense/analytics'

analytics.load('your_api_key');
analytics.identify("your_user_identifier");
analytics.track('plan-upgrade', { metadata: { plan: 'premium' } });

Installation

npm install @cxsense/analytics
# or
yarn add @cxsense/analytics

Anonymous users

Anonymous users can be identified by providing null as their identifier. Analytics generates an ID and store it in users browser localstorage.

analytics.identify(null);

By default, Analytics uses the same generated identifier whenever the above function is called. In case you need a new identifier you have to reset it.

analytics.reset();
analytics.identify(null);

API

Table of Contents

track

Track user interactions

Parameters

  • event string the name of the event to track.

  • properties Object event properties. (optional, default {})

    • properties.metadata Object the metadata that describes the event. (optional, default {})

    • properties.variation_settings Object additional tags and attributes that define the event. (optional, default {})

    • properties.item Object? user interactions with items in catalogues. If item provided, variation_settings will be ignored.

      • properties.item.catalogue Object The name of the catalogue.
      • properties.item.id Object The unique identifier of the item in the catalogue.

Examples

Track events with metadata

analytics.track('subscribed', {
  metadata: { email: '[email protected]' }
});

Track events that are defined with attributes

analytics.track('product_view', {
  variation_settings: { plan: 'premium', rate: '5star' }
});

Track events for items in a catalogue

analytics.track('article_read', {
  item: { catalogue: 'articles', id: 'your_article_id' }
});

identify

To get started with our libraries your users needs to be identified. Users in segments are identified by a unique profile identifier in CxSense.

If the user_id is not provided, the user is considered anonymous. In this case, a user identifier will be generated and stored in the local storage.

Parameters

  • user_id string The unique user identifier in your system. If not provided, a random identifier will be generated.

  • segment Object Segment object that describes the segment the user belongs to. (optional, default {})

    • segment.title string The title of the segment.
    • segment.settings string The segment properties.
  • user_properties (optional, default {})

  • properties Object User properties. (optional, default {})

Examples

Identify a known user

analytics.identify('your_user_id', {
 title: 'my_segment_name',
 settings: {
   tenant: "customer1",
 }
}, {
  name: 'John Doe',
  age: 30
});

Identify an anonymous user

analytics.identify(null)

Returns string profileId - User unique identifier in CxSense

onJourneyCompletion

Parameters

Examples

Listen to journey completion events

analytics.onJourneyCompletion((data) => console.log(data)))

onDestinationResponse

Parameters

Examples

Listen to destination success responses

analytics.onDestinationResponse((data) => console.log(data)))

journeyCompletionCallback

Type: Function

Parameters

  • data Object The event object.

    • data.journey string The journey title.
    • data.journeyId string The journey identifier.
    • data.segment_settings Object The segment properties.
    • data.user_id string The user identifier.
    • data.user_properties Object The user properties.

destinationResponseCallback

Type: Function

Parameters

  • data Object The event object.

    • data.journey string The journey title.

    • data.segment_settings Object The segment properties.

    • data.user_id string The user identifier.

    • data.user_properties Object The user properties.

    • data.destination Object The destination properties.

      • data.destination.title string The destination title.
      • data.destination.response Object The destination response data.

load

Parameters

  • apiKey string The API key for your CxSense account.

  • options Object Options object. (optional, default {})

    • options.observer string The websocket observer. (optional, default false)

Examples

Load the library with in-app notification

analytics.load('your_api_key', { observer: true })

License

@cxsense/analytics is MIT licensed.