From c684834c42c81d85f28d021731fda1b5e43d712e Mon Sep 17 00:00:00 2001 From: Mononaut Date: Wed, 14 Feb 2024 21:47:42 +0000 Subject: [PATCH 1/2] matomo tx events --- .../app/components/transaction/transaction.component.ts | 7 ++++++- frontend/src/app/services/enterprise.service.ts | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 589b48869..60797a9a1 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -26,6 +26,7 @@ import { RelativeUrlPipe } from '../../shared/pipes/relative-url/relative-url.pi import { Price, PriceService } from '../../services/price.service'; import { isFeatureActive } from '../../bitcoin.utils'; import { ServicesApiServices } from '../../services/services-api.service'; +import { EnterpriseService } from '../../services/enterprise.service'; @Component({ selector: 'app-transaction', @@ -116,12 +117,15 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { private servicesApiService: ServicesApiServices, private seoService: SeoService, private priceService: PriceService, - private storageService: StorageService + private storageService: StorageService, + private enterpriseService: EnterpriseService, ) {} ngOnInit() { this.acceleratorAvailable = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && this.stateService.env.ACCELERATOR && this.stateService.network === ''; + this.enterpriseService.page(); + this.websocketService.want(['blocks', 'mempool-blocks']); this.stateService.networkChanged$.subscribe( (network) => { @@ -527,6 +531,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { if (!this.txId) { return; } + this.enterpriseService.goal(8); this.showAccelerationSummary = true && this.acceleratorAvailable; this.scrollIntoAccelPreview = !this.scrollIntoAccelPreview; return false; diff --git a/frontend/src/app/services/enterprise.service.ts b/frontend/src/app/services/enterprise.service.ts index 7e69af223..e4ffa5ac5 100644 --- a/frontend/src/app/services/enterprise.service.ts +++ b/frontend/src/app/services/enterprise.service.ts @@ -139,6 +139,12 @@ export class EnterpriseService { this.getMatomo()?.trackGoal(id); } + page() { + const matomo = this.getMatomo(); + matomo.setCustomUrl(this.getCustomUrl()); + matomo.trackPageView(); + } + private getCustomUrl(): string { let url = window.location.origin + '/'; let route = this.activatedRoute; From dc50b40b69dceb96b8377012acc81f0d2ae71841 Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Thu, 22 Feb 2024 11:07:50 +0100 Subject: [PATCH 2/2] if matomo is undefined, don't try to use it --- frontend/src/app/services/enterprise.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/services/enterprise.service.ts b/frontend/src/app/services/enterprise.service.ts index e4ffa5ac5..d1e3624f9 100644 --- a/frontend/src/app/services/enterprise.service.ts +++ b/frontend/src/app/services/enterprise.service.ts @@ -141,8 +141,10 @@ export class EnterpriseService { page() { const matomo = this.getMatomo(); - matomo.setCustomUrl(this.getCustomUrl()); - matomo.trackPageView(); + if (matomo) { + matomo.setCustomUrl(this.getCustomUrl()); + matomo.trackPageView(); + } } private getCustomUrl(): string {