From caed8c80e0bd7b7bcdba9a44f313eb06e53250f1 Mon Sep 17 00:00:00 2001 From: "Ramon \"9Tails\" Canales" Date: Mon, 20 May 2024 15:48:39 +0100 Subject: [PATCH] feat(chore): removing masa analytics --- store/onboard.ts | 1 - utils/analytics.ts | 39 ++------------------------------------- 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/store/onboard.ts b/store/onboard.ts index f80979908..2a3661f62 100644 --- a/store/onboard.ts +++ b/store/onboard.ts @@ -79,7 +79,6 @@ export const useOnboardStore = defineStore("onboard", () => { await identifyWalletName(); account.value = updatedAccount; connectorName.value = updatedAccount.connector?.name; - identifyWallet(updatedAccount.address, walletName.value); } catch (err) { disconnect(); const error = formatError(err as Error); diff --git a/utils/analytics.ts b/utils/analytics.ts index c5c987f18..693252037 100644 --- a/utils/analytics.ts +++ b/utils/analytics.ts @@ -1,5 +1,3 @@ -import type { Hash } from "@/types"; - let analyticsLoaded = false; async function loadRudder() { @@ -14,17 +12,6 @@ async function loadRudder() { ); } -async function loadMasa() { - if (!window.MA) { - await new Promise((resolve) => setTimeout(resolve, 250)); - throw new Error("Masa not loaded"); - } - const runtimeConfig = useRuntimeConfig(); - window.masaAnalytics = new window.MA.MasaAnalytics({ - clientId: runtimeConfig.public.analytics.masa.clientId, - }); -} - export async function initAnalytics(): Promise { if (analyticsLoaded) return true; @@ -32,14 +19,13 @@ export async function initAnalytics(): Promise { const useRudder = Boolean( runtimeConfig.public.analytics.rudder.key && runtimeConfig.public.analytics.rudder.dataplaneUrl ); - const useMasa = Boolean(runtimeConfig.public.analytics.masa.clientId && runtimeConfig.public.analytics.masa.appId); - if ((!useRudder && !useMasa) || analyticsLoaded) { + + if (!useRudder || analyticsLoaded) { return false; } const services = []; if (useRudder) services.push(loadRudder()); - if (useMasa) services.push(loadMasa()); await Promise.all(services); analyticsLoaded = true; @@ -48,33 +34,12 @@ export async function initAnalytics(): Promise { export async function trackPage(): Promise { if (await initAnalytics()) { - const runtimeConfig = useRuntimeConfig(); window.rudderanalytics?.page(); - window.masaAnalytics?.firePageViewEvent({ - page: window.location.href, - additionalEventData: { appId: runtimeConfig.public.analytics.masa.appId }, - }); } } export async function trackEvent(eventName: string, params?: object): Promise { if (await initAnalytics()) { - const runtimeConfig = useRuntimeConfig(); window.rudderanalytics?.track(eventName, params); - window.masaAnalytics?.trackCustomEvent({ - eventName, - additionalEventData: { appId: runtimeConfig.public.analytics.masa.appId, ...params }, - }); - } -} - -export async function identifyWallet(userAddress: Hash | undefined, walletType?: string): Promise { - if (await initAnalytics()) { - const runtimeConfig = useRuntimeConfig(); - window.masaAnalytics?.fireConnectWalletEvent({ - user_address: userAddress, - wallet_type: walletType, - additionalEventData: { appId: runtimeConfig.public.analytics.masa.appId }, - }); } }