forked from input-output-hk/daedalus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request input-output-hk#3041 from input-output-hk/feat/ddw…
…-1125-analytics-prepare-release-backup [DDW-1125] Analytics
- Loading branch information
Showing
70 changed files
with
886 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: "3" | ||
services: | ||
mariadb: | ||
image: docker.io/bitnami/mariadb:10.6 | ||
environment: | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- MARIADB_USER=bn_matomo | ||
- MARIADB_DATABASE=bitnami_matomo | ||
- MARIADB_EXTRA_FLAGS=--max_allowed_packet=64MB | ||
volumes: | ||
- "matomo_db_data:/bitnami/mariadb" | ||
matomo: | ||
image: docker.io/bitnami/matomo:4 | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
- MATOMO_DATABASE_HOST=mariadb | ||
- MATOMO_DATABASE_PORT_NUMBER=3306 | ||
- MATOMO_DATABASE_USER=bn_matomo | ||
- MATOMO_DATABASE_NAME=bitnami_matomo | ||
- MATOMO_USERNAME=user | ||
- MATOMO_PASSWORD=password | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
volumes: | ||
- "matomo_data:/bitnami/matomo" | ||
depends_on: | ||
- mariadb | ||
volumes: | ||
matomo_db_data: | ||
driver: local | ||
matomo_data: | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { AnalyticsAcceptanceStatus, AnalyticsTracker } from '.'; | ||
import { AnalyticsClient } from './types'; | ||
import { Environment } from '../../../common/types/environment.types'; | ||
import LocalStorageApi from '../api/utils/localStorage'; | ||
import { MatomoClient } from './MatomoClient'; | ||
import { NoopAnalyticsClient } from './noopAnalyticsClient'; | ||
|
||
export class MatomoAnalyticsTracker implements AnalyticsTracker { | ||
#analyticsClient: AnalyticsClient; | ||
|
||
constructor( | ||
private environment: Environment, | ||
private localStorageApi: LocalStorageApi | ||
) { | ||
this.#analyticsClient = NoopAnalyticsClient; | ||
this.#enableTrackingIfAccepted(); | ||
} | ||
|
||
async enableTracking() { | ||
this.#analyticsClient = new MatomoClient( | ||
this.environment, | ||
await this.localStorageApi.getUserID() | ||
); | ||
} | ||
|
||
disableTracking() { | ||
this.#analyticsClient = NoopAnalyticsClient; | ||
} | ||
|
||
sendPageNavigationEvent(pageTitle: string) { | ||
return this.#analyticsClient.sendPageNavigationEvent(pageTitle); | ||
} | ||
|
||
sendEvent(category: string, name: string, action?: string) { | ||
return this.#analyticsClient.sendEvent(category, name, action); | ||
} | ||
|
||
async #enableTrackingIfAccepted() { | ||
const analyticsAccepted = | ||
(await this.localStorageApi.getAnalyticsAcceptance()) === | ||
AnalyticsAcceptanceStatus.ACCEPTED; | ||
|
||
if (this.environment.analyticsFeatureEnabled && analyticsAccepted) { | ||
this.enableTracking(); | ||
} | ||
} | ||
} |
Oops, something went wrong.