File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
plugins/analytics-module-matomo/src/api Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ import { AnalyticsEvent, ConfigApi } from '@backstage/core-plugin-api';
2
2
3
3
import { loadMatomo } from './loadMatomo' ;
4
4
5
+ declare const window : Window &
6
+ typeof globalThis & {
7
+ _paq : any [ ] ;
8
+ } ;
9
+
5
10
type AnalyticsAPI = { } ;
6
11
7
12
type Options = {
@@ -10,7 +15,6 @@ type Options = {
10
15
11
16
export class MatomoAnalytics implements AnalyticsAPI {
12
17
private readonly configApi : ConfigApi ;
13
- private paq : any [ ] ;
14
18
15
19
private constructor ( options : Options ) {
16
20
this . configApi = options . configApi ;
@@ -19,7 +23,6 @@ export class MatomoAnalytics implements AnalyticsAPI {
19
23
'app.analytics.matomo.siteId' ,
20
24
) ;
21
25
loadMatomo ( matomoUrl , matomoSiteId ) ;
22
- this . paq = ( window as any ) . _paq ;
23
26
}
24
27
25
28
static fromConfig ( config : ConfigApi ) {
@@ -30,7 +33,7 @@ export class MatomoAnalytics implements AnalyticsAPI {
30
33
const { context, action, subject, value } = event ;
31
34
// REF: https://github.com/backstage/backstage/blob/master/plugins/analytics-module-ga/src/apis/implementations/AnalyticsApi/GoogleAnalytics.ts#L160
32
35
// REF: https://matomo.org/faq/reports/implement-event-tracking-with-matomo/
33
- this . paq . push ( [
36
+ window . _paq . push ( [
34
37
'trackEvent' ,
35
38
context . extension || 'App' ,
36
39
action ,
You can’t perform that action at this time.
0 commit comments