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

nestjs-posthog

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-posthog

```shell ▶ yarn add nestjs-posthog ```

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
increased by183.33%
Maintainers
1
Weekly downloads
 
Created
Source

Logo

nestjs-posthog

Lightweight library to use Posthog in NestJS applications.

Quick Start Guide · Request Feature · Report Bug


code style: prettier Commitizen friendly Release

Language grade: JavaScript codecov

Posthog for Nestjs makes it easier to implement analytics with Posthog into your Nestjs application.

:space_invader:   Usage

▶ yarn add nestjs-posthog
import { Module } from '@nestjs/common';
import { PosthogModule } from 'nestjs-posthog';

@Module({
  imports: [
    PosthogModule.forRoot({
      apiKey: '<ph_project_api_key>',
      options: {
        host: '<ph_instance_address>',
      },
    }),
  ],
})
export class AppModule {}

Example

You can easily inject PosthogService to be used in your services, controllers, etc.

import { Injectable } from '@nestjs/common';
import { PosthogService } from 'nestjs-posthog';

@Injectable()
export class AuthService {
  constructor(private service: PosthogService) {}

  helloWorldMethod() {
    this.service.capture({
      distinctId: 'distinct id',
      event: 'movie played',
      properties: {
        movieId: '123',
        category: 'romcom',
      },
    });
    return 'hello world';
  }
}

Read more about the methods in Posthogs Node.js client documentation.

Contribute & Disclaimer

We love to get help 🙏 Read more about how to get started in CONTRIBUTING 🌳

This is a community-driven Open Source project with no ties with Posthog. It's supported on a volunteer-basis, but frequently used in commerical projects.

FAQs

Package last updated on 19 Mar 2022

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