diff --git a/run.sh b/run.sh index e389a46d3..0bbe01add 100644 --- a/run.sh +++ b/run.sh @@ -48,6 +48,7 @@ do sed -i $SED_EXTRA_ARGS "s?{{ENV_ID}}?${ENV_ID}?g" $f; sed -i $SED_EXTRA_ARGS "s?{{SUPPORT_EMAIL}}?${SUPPORT_EMAIL}?g" $f; sed -i $SED_EXTRA_ARGS "s?{{HELP_ARTICLE_DOMAIN}}?${HELP_ARTICLE_DOMAIN}?g" $f; + sed -i $SED_EXTRA_ARGS "s?{{MIXPANEL_PROJECT_TOKEN}}?${MIXPANEL_PROJECT_TOKEN}?g" $f; done nginx -g "daemon off;" diff --git a/src/app/core/services/integration/tracking.service.spec.ts b/src/app/core/services/integration/tracking.service.spec.ts index 0d77618bf..02485f0e6 100644 --- a/src/app/core/services/integration/tracking.service.spec.ts +++ b/src/app/core/services/integration/tracking.service.spec.ts @@ -9,9 +9,12 @@ describe('TrackingService', () => { beforeEach(() => { TestBed.configureTestingModule({}); service = TestBed.inject(TrackingService); - (window as any).analytics = { + (window as any).mixpanel = { track: () => undefined, - identify: () => undefined + identify: () => undefined, + people: { + set: () => undefined + } }; }); diff --git a/src/app/core/services/integration/tracking.service.ts b/src/app/core/services/integration/tracking.service.ts index e7a2e8654..0721d0889 100644 --- a/src/app/core/services/integration/tracking.service.ts +++ b/src/app/core/services/integration/tracking.service.ts @@ -52,7 +52,7 @@ export class TrackingService { } get tracking() { - return (window as any).analytics; + return (window as any).mixpanel; } eventTrack(action: string, trackingApp?: TrackingApp, properties: any = {}): void { @@ -61,19 +61,28 @@ export class TrackingService { ...flattenedObject, Asset: 'Integration Settings Web' }; - if (this.tracking) { - this.tracking.track(`${trackingApp ? trackingApp : 'Integration Settings Web'}: ${action}`, properties); + try { + if (this.tracking) { + this.tracking.track(`${trackingApp ? trackingApp : 'Integration Settings Web'}: ${action}`, properties); + } + } catch (e) { + console.error('Tracking error:', e); } } onOpenLandingPage(email: string | undefined, orgId: number, orgName: string, fyleOrgId: string): void { - if (this.tracking) { - this.tracking.identify(email, { - orgId, - orgName, - fyleOrgId - }); - this.identityEmail = email; + try { + if (this.tracking) { + this.tracking.identify(email); + this.tracking.people.set({ + orgId, + orgName, + fyleOrgId + }); + this.identityEmail = email; + } + } catch (e) { + console.error('Tracking error:', e); } this.eventTrack('Opened Landing Page'); } diff --git a/src/index.html b/src/index.html index f4710eb2b..451815787 100644 --- a/src/index.html +++ b/src/index.html @@ -6,15 +6,22 @@ - +