diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 56aaaaa204d324718e4fd53a0e5c15ea1a84dbe6..6d6f9fb6c62e10d55d50916a374aa1bfe005abf2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -103,6 +103,8 @@ export class AppComponent implements OnInit, OnDestroy, Observer { // évite de mettre en place un bandeau RGPD this.matomoTracker.disableCookies(); + // Set custom dimension for Electron / Cordova / pure Web browser + this.matomoTracker.setCustomDimension(1, this.getRunningPlatform()); // Matomo open-source Web analytics this.matomoInjector.init("https://stasi.g-eau.fr/", 1); @@ -819,6 +821,21 @@ export class AppComponent implements OnInit, OnDestroy, Observer { return "assets/docs/" + this.appSetupService.language + "/index.html"; } + /** + * Returns a string representing the running platform : + * "cordova", "electron", or "browser" + */ + public getRunningPlatform(): string { + let runningPlatform = "browser"; + if (navigator.userAgent.toLowerCase().indexOf("electron") > -1) { + runningPlatform = "electron"; + } else if (window.cordova) { + runningPlatform = "cordova"; + } + // console.log(">> running platform: ", runningPlatform); + return runningPlatform; + } + /** * détection de la fermeture de la page/navigateur et demande de confirmation */