Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

posthog-node

Package Overview
Dependencies
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthog-node

PostHog Node.js integration

  • 4.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
406K
decreased by-1.23%
Maintainers
4
Weekly downloads
 
Created

What is posthog-node?

The posthog-node package is a Node.js library for interacting with PostHog, an open-source product analytics platform. It allows you to track events, identify users, and manage feature flags programmatically from your Node.js applications.

What are posthog-node's main functionalities?

Track Events

This feature allows you to track events that occur in your application. The `capture` method is used to log an event with a distinct user ID and any relevant properties.

const { PostHog } = require('posthog-node');
const client = new PostHog('YOUR_API_KEY');

client.capture({
  distinctId: 'user123',
  event: 'user_signed_up',
  properties: {
    plan: 'premium'
  }
});

Identify Users

This feature allows you to identify users and associate them with specific properties. The `identify` method is used to set or update user properties.

const { PostHog } = require('posthog-node');
const client = new PostHog('YOUR_API_KEY');

client.identify({
  distinctId: 'user123',
  properties: {
    email: 'user@example.com',
    name: 'John Doe'
  }
});

Feature Flags

This feature allows you to manage feature flags, enabling or disabling features for specific users. The `isFeatureEnabled` method checks if a feature flag is enabled for a given user.

const { PostHog } = require('posthog-node');
const client = new PostHog('YOUR_API_KEY');

client.isFeatureEnabled('new-feature', 'user123').then(isEnabled => {
  if (isEnabled) {
    console.log('Feature is enabled for this user');
  } else {
    console.log('Feature is not enabled for this user');
  }
});

Other packages similar to posthog-node

Keywords

FAQs

Package last updated on 20 Aug 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc