UNPKG

@janus-idp/backstage-plugin-analytics-module-matomo

Version:

This plugin provides an opinionated implementation of the Backstage Analytics API for Matomo Analytics. Once installed and configured, analytics events will be sent to Matomo as your users navigate and use your Backstage instance.

30 lines (27 loc) 737 B
import { loadMatomo } from './loadMatomo.esm.js'; class MatomoAnalytics { configApi; constructor(options) { this.configApi = options.configApi; const matomoUrl = this.configApi.getString("app.analytics.matomo.host"); const matomoSiteId = this.configApi.getNumber( "app.analytics.matomo.siteId" ); loadMatomo(matomoUrl, matomoSiteId); } static fromConfig(config) { return new MatomoAnalytics({ configApi: config }); } captureEvent(event) { const { context, action, subject, value } = event; window._paq.push([ "trackEvent", context.extension || "App", action, subject, value ]); } } export { MatomoAnalytics }; //# sourceMappingURL=Matomo.esm.js.map