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

sidelines-amplitude

v1.1.2

Published

Send events to Amplitude

Readme

sidelines-amplitude

This Node.js package enables the creation of multiple, distinct Amplitude instances for event tracking, differentiated by unique API keys. It's designed to integrate seamlessly into your projects, allowing for sophisticated event and session management tailored to individual company settings in Amplitude.

Features

  • Multiple Instances: Easily configure multiple Amplitude clients.
  • Customizable Options: Set session identifiers, timeouts, and more.
  • Enhanced Logging: Integrate with your existing logging system for better debug capabilities.
  • Bulk Event Handling: Efficiently manage event uploads within Amplitude's recommended limits.

Getting Started

Installation

Install using npm:

    npm install sidelines-amplitude
    

Or using yarn:

    yarn add sidelines-amplitude

Configuration

Require and configure the package in your Node.js application:

        const Amplitude = require('sidelines-amplitude');
        const amplitudeClient = new Amplitude({{apiKey, companyName, options}});

Multiple instances can be created for different api keys companyName should be exact spelled as the Amplitude settings> Organization settings> General> Organization

Options params (optional)

  • session_id_key ('user_id') - Let you associate events with a particular session identifier.
  • session_timeout (5 * 60) - The time each session exists on amplitude, renew every event send.
  • attribution_event_type ('CompanyName install') - Determine which event will be sent on the attribution.
  • with_logs (false) - If true the package will send messages to console.
  • logger_cb (null) - If you would like to connect the package to you logger.

How to use

Send event

Send single event to amplitude. event - Object.required. type - string 'event' / 'attribution' (default: 'event'). session - boolean - Weather if to use Amplitude sessions logic or not (default: false).

        await amplitudeClient.sendEvent({event, type, session})

Event schema

   user_id: string.required
   event_type: string.required
   event_properties: object.optional
   user_properties: object.optional
   root_properties: object.optional
   session_id: string || -1

Attribution event schema

   user_id: string.required,
   platform: string.required.lowercase(),
   user_properties: object.optional,
   android_id: string.optional,
   adid: string.required on android,
   idfa: string.required on IOS (on of idfa || idfv),
   idfv: string.required on IOS (on of idfa || idfv),
   time: number.optional

Send bulk events

Send events in bulks according to Amplitude's rate limits

"Limit your upload to 100 batches per second and 1000 events per second. You can batch events into an upload, but we recommend not sending more than 10 events per batch. Amplitude expects fewer than 100 batches per second, and the 1000 events per second limit still applies."

        await bulkSendEvents = async (events)

logger_cb

There is a option to add logger_cb on the amplitude instance options. Example:

        const Amplitude = require('sidelines-amplitude');
        const loggerCb = (logType, log) => logger[logType](log);
        const amplitudeClient = new Amplitude({{apiKey, companyName, options:{ logger_cb: loggerCb }}});

loggerCb Params:

    logType: info/ error
    log : {message, error}