From fae91a0b654fdc9c1d09c32d7acf22ffbf6d2e14 Mon Sep 17 00:00:00 2001 From: crisnicandrei <62384997+crisnicandrei@users.noreply.github.com> Date: Thu, 14 Mar 2024 13:58:51 +0200 Subject: [PATCH] Removed mixpanel tracking from the web-app --- .../upload-button/upload-button.component.ts | 13 ------- .../services/mixpanel/mixpanel.service.ts | 36 +------------------ src/test.ts | 2 -- 3 files changed, 1 insertion(+), 50 deletions(-) diff --git a/src/app/core/components/upload-button/upload-button.component.ts b/src/app/core/components/upload-button/upload-button.component.ts index f7218e36f..815612841 100644 --- a/src/app/core/components/upload-button/upload-button.component.ts +++ b/src/app/core/components/upload-button/upload-button.component.ts @@ -1,5 +1,4 @@ /* @format */ -import { MixpanelService } from '@shared/services/mixpanel/mixpanel.service'; import { Component, OnInit, @@ -106,18 +105,6 @@ export class UploadButtonComponent async onFileChange(event) { this.files = Array.from(event.target.files); if (this.currentFolder) { - const account = this.account.getAccount(); - const workspace = this.currentFolder.type.includes('private') - ? 'Private' - : 'Public'; - - // await this.api.mixpanel.sendData({ - // entity:'record', - // action:'submit', - // version:1, - // entityId:account.accountId.toString(), - // }) - // this.mixpanel.track('Finalize Upload', { workspace }); if (this.currentFolder.type.includes('public')) { try { await this.prompt.confirm( diff --git a/src/app/shared/services/mixpanel/mixpanel.service.ts b/src/app/shared/services/mixpanel/mixpanel.service.ts index e6bc874af..cc86d54ae 100644 --- a/src/app/shared/services/mixpanel/mixpanel.service.ts +++ b/src/app/shared/services/mixpanel/mixpanel.service.ts @@ -1,10 +1,7 @@ /* @format*/ -import { DeviceService } from '@shared/services/device/device.service'; import { Injectable } from '@angular/core'; -import mixpanel from 'mixpanel-browser'; import { environment } from '@root/environments/environment'; import { AccountVO } from '@models/account-vo'; -import { SecretsService } from '../secrets/secrets.service'; @Injectable({ providedIn: 'root', @@ -15,17 +12,7 @@ export class MixpanelService { protected token: string; private mixpanelIdentifier: string; - constructor(secrets: SecretsService, private deviceService: DeviceService) { - if (secrets.get('MIXPANEL_TOKEN') && MixpanelService.enableMixpanel) { - this.token = secrets.get('MIXPANEL_TOKEN'); - this.enabled = true; - mixpanel.init(this.token, { - debug: environment.analyticsDebug, - persistence: 'localStorage', - track_pageview: true, - }); - } - } + constructor() {} public setMixpanelIdentifier(account: AccountVO): void { if (this.enabled) { @@ -33,12 +20,6 @@ export class MixpanelService { this.mixpanelIdentifier = environment.analyticsDebug ? `${environment.environment}:${account.accountId}` : `${account.accountId}`; - // mixpanel.identify(mixpanelIdentifier); - // mixpanel.people.set({ - // $email: account.primaryEmail, - // accountId: `${account.accountId}`, - // environment: environment.environment, - // }); } } } @@ -46,19 +27,4 @@ export class MixpanelService { public getMixpanelIdentifier(): string { return this.mixpanelIdentifier; } - - public track(eventName: string, data: Object): void { - if (this.enabled) { - mixpanel.track(eventName, data); - } - } - - public isEnabled(): boolean { - return this.enabled; - } - - public trackPageView(page: string): void { - const trackMessage = this.deviceService.getViewMessageForEventTracking(); - this.track(trackMessage, { page }); - } } diff --git a/src/test.ts b/src/test.ts index ce72a1e28..8fe3ee713 100644 --- a/src/test.ts +++ b/src/test.ts @@ -17,7 +17,6 @@ import { NgbTimepickerModule, NgbTooltipModule, } from '@ng-bootstrap/ng-bootstrap'; -import { MixpanelService } from '@shared/services/mixpanel/mixpanel.service'; window['Stripe'] = () => { return { @@ -42,7 +41,6 @@ window['Stripe'] = () => { window['doNotLoadGoogleMapsAPI'] = true; // Disable loading of MixPanel -MixpanelService.enableMixpanel = false; // Always Replace RouterModule with RouterTestingModule to avoid errors. Shallow.alwaysReplaceModule(RouterModule, RouterTestingModule);