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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@amplitude/node

v1.10.2

Published

Offical Amplitude SDK for Node.js

Downloads

413,488

Readme

npm version

Official Amplitude SDK for Node.js

This is Amplitude Node.js SDK written in Typescript, the 1st backend SDK for Amplitude. Currently, it's in beta version, but we would like to hear your ideas too! At this moment, we keep it minimal and simple because we want to give more thoughts over different customers' needs. Modularization and flexiblity will be the main priorities for this SDK.

Installation and Quick Start

Please visit our :100:Developer Center for instructions on installing and using our the SDK.

Node and JS SDK's

There might be confusion about the use case and motivations for building the Node SDK when we have a JS SDK. The Amplitude-Javascript SDK is meant to be run in browser environments and on client devices, resulting in very different designs and assumptions. For example, the Javascript SDK contains functionality that interfaces specifically with Web APIs (e.g. referrer and UTM attribution information, navigator.language), and that it can store metadata in API's such as cookies and localStorage. It also makes other assumptions, such as that there is only one active "identity" sending events at a time.

In contrast, the Node SDK is meant to be run in a Node environment, and kept as flexible and modular as possible as to accommodate the various different use cases it may be used in. It makes fewer assumption on how many users it is processing and what is available. Though we primarily foresee the Node SDK being used in server environments, we would love to hear how you plan to use it!

Retry Behavior

One of the important aspects and functionalities of the Node SDK is its ability to retry event payloads that fail. Network requests can fail for a variety of reasons, and it is important that the SDK provides a layer of robustness and correctness when these failures happen.

By default, the Node SDK will retry events on loop after a short pause if it finds that a request has failed; however, this strategy is not ideal for every use case. As such, you can provide your own retryClass that implements the exported Retry interface (currently a single sendEventsWithRetry function). For example, there is a secondary OfflineRetryHandler that is meant for a more opinionated use case where network requests may not always be available for long periods of time:

import { init, OfflineRetryHandler } from "@amplitude/node"

const amplitudeClient = init('YOUR_API_KEY', { retryClass: new OfflineRetryHandler('YOUR_API_KEY') })

As well as a BaseRetryHandler that does no retrying at all but contains several helper functions to extend from.

Need Help?

If you have any problems or issues over our SDK, feel free to create a github issue or submit a request on Amplitude Help.