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

@newageerp/node-analytics

v1.0.53

Published

```bash npm install @newageerp/node-analytics ```

Readme

install

npm install @newageerp/node-analytics

ENV variables

  • CRM_ADS_BACKEND - if facebook capi (s2s) is needed, mostly YES
  • ANALYTICS_PROJECT - if analytics used, mostly YES
  • AMQP_AN_QUEUE - if analytics used, mostly YES
  • AMQP_KL_QUEUE - if klaviyo is used, mostly YES

.env / .env.stg example

CRM_ADS_BACKEND=https://ads.crm.apidata.app/app/Pub/S2S
AMQP_AN_QUEUE=staging.common.analytics
AMQP_KL_QUEUE=based on project (see below)
ANALYTICS_PROJECT=staging

.env.prod example

  • CRM_ADS_BACKEND - replace apidata.app with project domain (if this is a test/RnD project, then use the domain of the main project, whose payments are used)
  • AMQP_AN_QUEUE possible production variables (if there are no suitable ones, contact the manager)
    • biofema.front.analytics
    • herwealth.front-en.analytics
    • mellow.front-en.analytics
    • parentingleader.front-en.analytics
    • shiftmind.app.analytics
    • shiftmind.front.analytics
    • today.app-en.analytics
    • today.front-en.analytics
    • today.front-fr.analytics
    • wingman.front-en.analytics
    • frb.front.analytics (Forbio)
    • frb.app.analytics (Forbio)
    • bls.front.analytics (Blessify)
    • wws.front.analytics (WorkWithShadow)
    • wws.app.analytics (WorkWithShadow)
  • AMQP_KL_QUEUE possible production variables (if there are no suitable ones, contact the manager)
    • biofema.klaviyo
    • cosmic.klaviyo
    • mellow.klaviyo
    • parenting.klaviyo
    • shiftmind.klaviyo
    • today.klaviyo
    • today_kendago.klaviyo
    • wingman.klaviyo
    • bls.klaviyo (Blessify)
    • frb.klaviyo (Forbio)
    • wws.klaviyo (WorkWithShadow)
  • ANALYTICS_PROJECT - ask manager

middleware.ts

import { analyticsSrv } from '@newageerp/node-analytics'

const analyticsResp = await analyticsSrv.checkForRoutes(req, `${process.env.ANALYTICS_PROJECT}`, 'amqp')
if (analyticsResp) {
    return analyticsResp
}

export const config = {
    matcher: '/((?!_next/static|_next/image|favicon.ico).*)',
}

Usage

analytic events

track event [- IMPORTANT -]

mostly used events we want a track

  • Landing or HomePage - call on homepage
  • StartQuiz - when first question appear or on start quiz button click
  • FinishQuiz - when quiz finished
  • ResultsPage - on result page load
  • EmailPage - on email page load
  • EmailLeft - on email submit
  • CheckoutPage - on checkout page load
  • PaymentWindow - on checkout page load
  • Purchase - on paid/[uuid] route
  • UpSellRedirect - see example in node/ab-tool package
  • Q-001 - Q-999 - Quiz steps

[- IMPORTANT -] old projects may use different event names, do not change them to the ones above without a special task

useEffect(() => {
    analyticsBrowser.anTrackEvent(eventName).catch(console.error)
}, [])

s2s / capi

after purchase confirmation (server side)

await facebookSrv.s2s({
    sourceUrl: `${json.origin}`,
    uuid,
    total,
})

klaviyo

send event to klaviyo

await klaviyoBrowser.track({
    eventName: 'user_created',
    email: email.trim(),
    properties: {},
    customerProperties: {
        initQuery: analyticsBrowser.getSearchParamsFromLocalStorage(),
        initFunnel: getLandingFlowRootPath(params),
    },
})

GA Events [- IMPORTANT -]

gaAfterUserCreateEvent

call when user provides email, most often on email/[uuid] path

analyticsBrowser.gaAfterUserCreateEvent({ uuid, email })

gaAfterCreateSessionEvent

call after we create session, most often after quiz finish

analyticsBrowser.gaAfterCreateSessionEvent({ uuid })

gaAfterPurchaseEvent

call after paid confirmation, paid/[uuid] page

analyticsBrowser.gaAfterPurchaseEvent({uuid, currency, total})

gaAfterUpsellEvent

call after success upsell charge

analyticsBrowser.gaAfterUpsellEvent({uuid, currency, total})

gaOnCheckoutPageEvent

call on checkout page load

analyticsBrowser.gaOnCheckoutPageEvent({ uuid })

gaOnPaymentWindowEvent

call on payment window appear

analyticsBrowser.gaOnPaymentWindowEvent({
    uuid,
    total,
    currency,
})