Analytics Service

class AnalyticsService

This service is a wrapper for communicating with your analytics service (like Google Analytics), to manage events.

It forwards the event name and data to the Logger Service, but should be changed to forward it to your analytics service after integration.

analytics.service.ts
@Injectable({
  providedIn: 'root',
})
export class AnalyticsService {
  private readonly _isAnalyticsEnabled = inject(IS_ANALYTICS_ENABLED);
  private readonly _loggerService = inject(LoggerService);

  public constructor() {
    // Buy to unlock
  }

  public logEvent(eventName: string, eventData?: unknown): void {
    // Buy to unlock
  }
}

Last updated