![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
posthog-node
Advanced tools
Readme
Official PostHog NodeJS library to capture and send events to any PostHog instance (including posthog.com).
This library uses an internal queue to make calls non-blocking and fast. It also batches requests and flushes asynchronously, making it perfect to use in any part of your web app or other server side application that needs performance.
Run either the yarn
or npm
program to add it to your project
npm install posthog-ruby
yarn add posthog-ruby
In your app, set your api key before making any calls.
import PostHog from 'posthog-node'
const client = new PostHog('API key')
You can find your key in the /setup page in PostHog.
Capture allows you to capture anything a user does within your system, which you can later use in PostHog to find patterns in usage, work out which features to improve or where people are giving up.
A capture
call requires
distinct id
which uniquely identifies your userevent name
to make sure
movie played
or movie updated
to easily identify what your events mean later on.Optionally you can submit
properties
, which can be a dict with any information you'd like to addFor example:
client.capture({
distinctId: 'distinct id',
event: 'movie played',
properties: {
movieId: '123',
category: 'romcom'
}
})
Identify lets you add metadata on your users so you can more easily identify who they are in PostHog, and even do things like segment users by these properties.
An identify
call requires
distinct id
which uniquely identifies your userproperties
with a dict with any key: value pairsFor example:
client.identify({
distinctId: "user:123",
properties: {
email: 'john@doe.com',
proUser: false
}
})
The most obvious place to make this call is whenever a user signs up, or when they update their information.
To marry up whatever a user does before they sign up or log in with what they do after you need to make an alias call. This will allow you to answer questions like "Which marketing channels leads to users churning after a month?" or "What do users do on our website before signing up?"
In a purely back-end implementation, this means whenever an anonymous user does something, you'll want to send a session ID with the capture call. Then, when that users signs up, you want to do an alias call with the session ID and the newly created user ID.
The same concept applies for when a user logs in.
If you're using PostHog in the front-end and back-end, doing the identify
call in the frontend will be enough.
An alias
call requires
distinct id
the current unique idalias
the unique ID of the user beforeFor example:
client.alias({
distinctId: "user:123",
alias: "user:12345",
})
This library is largely based on the analytics-node
package.
FAQs
PostHog Node.js integration
The npm package posthog-node receives a total of 251,875 weekly downloads. As such, posthog-node popularity was classified as popular.
We found that posthog-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.