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

windsor-node

v1.0.0

Published

Integrate user and event capture with Node applications

Downloads

19

Readme

windsor-node

Send data for Windsor.io from Node

Get started

  1. Create a Windsor Account
  2. Setup the Node source
  3. Create Users on Windsor
    • With windsor-node, call windsor.user(...) everytime a new user signs up or data about a user changes to keep things updated
  4. Track Events
    • You'll want to see every important event or issue your user runs into. Call windsor.event(...) for every event you want to know a user has taken. You can setup alerts and more from Windsor

Read the docs here.

Why?

You care about your users. You probably already have a slack channel filling up with important events, or you search through logs to see what your users are upto. Windsor is a better way. Track the users and events you care about to Windsor so your company can more easily manage and understand your user behavior.

For example, you can create a new Windsor user from any Node app:

windsor.user({
  userId: "01nc83ns",
  traits: {
    name: "Pranay Prakash",
    email: "[email protected]",
    company: "windsor",
    posts: 42,
  },
});

And track events you'd like to know your users took

windsor.event({
  userId: "01nc83ns",
  event: "Post Created",
  properties: {
    title: "Getting Started",
    private: false,
  },
});

Then follow the user on Windsor

Installation

$ yarn add windsor-node

Usage

const Windsor = require("windsor-node");

const windsor = new Windsor("token");

windsor.user({
  userId: "user id",
  traits: {
    name: "user name",
    email: "user email",
  },
});

windsor.event({
  event: "event name",
  userId: "user id",
});

Advanced Usage

windsor-node batches and sends multiple events together to improve performance on production systems. When using windsor-node on a serverless/lambda environment like AWS Lambda, Vercel or Serverless, you need to ensure that all events are sent before responding to the request.

const Windsor = require("windsor-node");
const windsor = new Windsor("token");

exports.handler = async (event) => {
  let greeting = "";
  if (event.queryStringParameters && event.queryStringParameters.greeting) {
    console.log("Received greeting: " + event.queryStringParameters.greeting);
    greeting = event.queryStringParameters.greeting;
  }

  // A promise is returned, but instead of using await here
  // we can send multiple analytics events and then await a single
  // call to windsor.flush() before returning the response
  windsor.event({
    event: "Sent Greeting",
    properties: {
      greeting,
    },
  });

  const message = `${greeting} World.`;
  const responseBody = { message };
  const response = {
    statusCode: 200,
    body: JSON.stringify(responseBody),
  };

  await windsor.flush();
  return response;
};

Documentation

Documentation is available at https://docs.windsor.io/docs/analytics

License

Copyright © 2020 Windsor Software Inc. <[email protected]>

See the LICENSE file for details and see the SEGMENT_LICENSE file attribution to the Segment Library this was based off.