Socket
Socket
Sign inDemoInstall

@jitsu/angular

Package Overview
Dependencies
6
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jitsu/angular

Jitsu JavaScript SDK for Angular (more at http://jitsu.com/docs/js-sdk)


Version published
Maintainers
3
Created

Readme

Source

Official Jitsu SDK for Angular

Questions?

Join Jitsu Slack

General

This package is a wrapper around @jitsu/sdk-js, with added functionality related to Angular.

Installation

To use Jitsu SDK, install npm package

npm install @jitsu/angular

and import Jitsu SDK module to your Angular application.

import { NgxJitsuModule } from '@jitsu/angular';

@NgModule({
  // ...
  imports: [
    NgxJitsuModule.forRoot({
      tracking_host: "__JITSU_HOST__",
      key: "__API_KET__",
          // See Jitsu SDK parameters section for more options
    }),
  ],
  // ...
})
export class AppModule {}

List of all parameters available in the SDK Reference

Usage

@Component({
  selector: 'app-root',
  template: '<button (click)="onBtnClick(\'test_btn\')">Test button</button>',
})
export class AppComponent implements OnInit {
  constructor(private jitsuTracker: NgxJitsuService, private someUserService: SomeUserService) {
    // subscribe on router navigation end event and track page view
    router.events
      .filter(event => event instanceof NavigationEnd)
      .subscribe((event: NavigationEnd) => {
        this.jitsuTracker.trackPageView()
      });
  }
  
  onBtnClick(btnName:string) {
    // send btn_click_event with button name payload on button click
    this.jitsuTracker.track('btn_click_event', {btn: btnName})
  }
  
  ngOnInit() {
    // identify current user for all track events
    this.someUserService.currentUser.subscribe((user: User) => {
      this.jitsuTracker.id({id: user.ID, email: user.EMAIL})
    });
  }
}

Jitsu SDK parameters and methods

Example app

You can find example app here.

FAQs

Last updated on 26 Jan 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc