Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Commit

Permalink
add Matomo
Browse files Browse the repository at this point in the history
  • Loading branch information
PrabhuSuriya committed Apr 21, 2022
1 parent b318c03 commit bbf4209
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
18 changes: 17 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
"@ngrx/router-store": "^10.1.2",
"@ngrx/store": "^10.1.2",
"@ngrx/store-devtools": "^10.1.2",
"@ngx-matomo/router": "^1.3.5",
"@ngx-matomo/tracker": "^1.3.5",
"@ngx-translate/core": "^12.1.2",
"@ngx-translate/http-loader": "^4.0.0",
"@sentry/browser": "^6.17.2",
Expand Down
10 changes: 10 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { CookieLawModule } from 'angular2-cookie-law';
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
import { NgxMatomoTrackerModule } from '@ngx-matomo/tracker';
import { NgxMatomoRouterModule } from '@ngx-matomo/router';

import { AppComponent } from './app.component';
import { AppStoreModule } from './store/store.module';
Expand Down Expand Up @@ -38,6 +40,7 @@ import { DateTimeUtilService } from './store/services/datetime-util.service';
import { NotificationService } from './store/services/notification.service';
import { TimezoneService } from './store/services/timezone.service';
import { errorHandlerFactory } from './app.error-handler';
import { getMatomoSiteID, getMatomoUrl, isMatomoEnabled } from './shared/config';

// AoT requires an exported function for factories
export function HttpLoaderFactory(http: HttpClient) {
Expand Down Expand Up @@ -70,6 +73,13 @@ export function HttpLoaderFactory(http: HttpClient) {
UsersModule,
CookieLawModule,
CKEditorModule,
NgxMatomoTrackerModule.forRoot({
siteId: getMatomoSiteID(),
trackerUrl: getMatomoUrl(),
trackAppInitialLoad: true,
disabled: !isMatomoEnabled(),
}),
NgxMatomoRouterModule,
],
providers: [
AuthGuard,
Expand Down
12 changes: 12 additions & 0 deletions src/app/shared/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ export function getEmailDomain(): string {
return 'dev.ctemplar.com';
}

export function getMatomoUrl(): string {
return 'https://traffic.ctemplar.net/';
}

export function getMatomoSiteID(): number {
return 2;
}

export function isMatomoEnabled(): boolean {
return AppConfig.production;
}

export const apiUrl = getBaseUrl();
export const PRIMARY_DOMAIN = AppConfig.production ? 'ctemplar.com' : 'dev.ctemplar.com';
export const PRIMARY_WEBSITE = 'https://ctemplar.com';
Expand Down

0 comments on commit bbf4209

Please sign in to comment.