Analytics Directive

class AnalyticsDirective

This directive listens to click events for analytics.

It forwards the event name and data to the Analytics Service for further handling.

analytics.directive.ts
@Directive({
  selector: '[jetAnalytics]',
  standalone: true,
})
export class AnalyticsDirective {
  private readonly _analyticsService = inject(AnalyticsService);
  private readonly _loggerService = inject(LoggerService);

  public jetAnalyticsEventData: InputSignal<unknown> = input();
  public jetAnalyticsEventName: InputSignal<string> = input.required();

  public constructor() {
    // Buy to unlock
  }

  @HostListener('click') public logClick(): void {
    // Buy to unlock
  }
}

Last updated