{"library":"ngx-matomo-client","title":"Matomo Client for Angular (ngx-matomo-client)","description":"ngx-matomo-client is a robust, actively maintained library providing seamless integration of Matomo (formerly Piwik) analytics into Angular applications. The current stable version is 9.0.1, offering compatibility with Angular 21. The library generally follows Angular's release cadence, providing updates for new major Angular versions, typically within weeks of their release. Key differentiators include its focus on privacy-respecting analytics, explicit support for Angular's module-less applications (since v8.0.0), and the ability to run tracking operations outside Angular's change detection zone for improved performance and stability. This package consolidates functionality previously split across `@ngx-matomo/tracker` and `@ngx-matomo/router` since version 5, simplifying usage and reducing overhead for developers integrating Matomo with Angular's routing.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install ngx-matomo-client"],"cli":null},"imports":["import { provideMatomo } from 'ngx-matomo-client';","import { MatomoService } from 'ngx-matomo-client';","import { MatomoRouterInitializer } from 'ngx-matomo-client';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { Component, OnInit } from '@angular/core';\nimport { MatomoService, provideMatomo, withRouter } from 'ngx-matomo-client';\nimport { bootstrapApplication } from '@angular/platform-browser';\nimport { provideRouter, RouterOutlet } from '@angular/router';\n\n@Component({\n  selector: 'app-root',\n  standalone: true,\n  imports: [RouterOutlet],\n  template: `\n    <h1>Welcome to Matomo Tracking!</h1>\n    <p>Check your Matomo dashboard for tracking data.</p>\n    <button (click)=\"trackCustomEvent()\">Track Custom Event</button>\n  `\n})\nexport class AppComponent implements OnInit {\n  constructor(private matomoService: MatomoService) {}\n\n  ngOnInit(): void {\n    // Manually track a page view if not using router integration\n    // this.matomoService.trackPageView();\n  }\n\n  trackCustomEvent(): void {\n    this.matomoService.trackEvent('UserInteraction', 'ButtonClick', 'CustomButton');\n    console.log('Custom event tracked!');\n  }\n}\n\nbootstrapApplication(AppComponent, {\n  providers: [\n    provideRouter([]),\n    provideMatomo({\n      trackerUrl: 'https://your-matomo-domain.com/matomo.php',\n      siteId: 1\n    }, withRouter())\n  ]\n});","lang":"typescript","description":"This quickstart sets up Matomo in a standalone Angular application, including router tracking and an example of manually tracking a custom event. Replace `trackerUrl` and `siteId` with your Matomo instance details.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}