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

posthog-js

Package Overview
Dependencies
Maintainers
4
Versions
634
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthog-js

Posthog-js allows you to automatically capture usage and send events to PostHog.

  • 1.57.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
651K
increased by0.01%
Maintainers
4
Weekly downloads
 
Created

What is posthog-js?

The posthog-js npm package is a JavaScript library for integrating PostHog analytics into web applications. It allows you to track user interactions, capture events, and analyze user behavior in real-time.

What are posthog-js's main functionalities?

Initialization

Initialize the PostHog library with your API key and optional configuration settings.

const posthog = require('posthog-js');
posthog.init('YOUR_API_KEY', { api_host: 'https://app.posthog.com' });

Capture Events

Capture custom events with properties to track user interactions and behaviors.

posthog.capture('event_name', { property1: 'value1', property2: 'value2' });

Identify Users

Identify users with unique IDs and associate them with properties like email and name.

posthog.identify('user_id', { email: 'user@example.com', name: 'John Doe' });

Set User Properties

Set properties for identified users to enrich user profiles with additional information.

posthog.people.set({ property1: 'value1', property2: 'value2' });

Feature Flags

Check if a feature flag is enabled for the current user to implement feature toggling.

const isEnabled = posthog.isFeatureEnabled('feature_flag_key');

Other packages similar to posthog-js

FAQs

Package last updated on 23 May 2023

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