From c1600d2d6c4933eafd3422fac16053141280dfec Mon Sep 17 00:00:00 2001 From: Ezra Sowden-Guzman Date: Fri, 29 Dec 2023 17:04:56 -0500 Subject: [PATCH 1/5] add fathom analytics --- src/App.vue | 7 +++++++ src/antelope/mocks/ChainStore.ts | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index 4236ce78e..6a5794d53 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,6 +7,13 @@ export const isTodayBeforeTelosCloudDown = new Date().getTime() < new Date('2023 export default defineComponent({ name: 'App', mounted() { + const script = document.createElement('script'); + script.src = 'https://cdn.usefathom.com/script.js'; + script.dataset.site = 'PDKJSBKL'; + script.dataset.spa = 'auto'; + script.defer = true; + document.body.appendChild(script); + if (isTodayBeforeTelosCloudDown) { getAntelope().config.notifyRememberInfoHandler( this.$t('temporal.telos_cloud_discontinued_title'), diff --git a/src/antelope/mocks/ChainStore.ts b/src/antelope/mocks/ChainStore.ts index ffcdc7340..b55263638 100644 --- a/src/antelope/mocks/ChainStore.ts +++ b/src/antelope/mocks/ChainStore.ts @@ -1,6 +1,7 @@ /* eslint-disable no-unused-vars */ /* eslint-disable @typescript-eslint/no-unused-vars */ // Mocking ChainStore ----------------------------------- +declare const fathom: { trackGoal: (eventId: string, value: 0) => void }; import { RpcEndpoint } from 'universal-authenticator-library'; import { NativeCurrencyAddress, TokenClass } from 'src/antelope/types'; @@ -23,7 +24,15 @@ export interface EVMChainSettings { const settings = { getChainId: () => process.env.NETWORK_EVM_CHAIN_ID, getDisplay: () => process.env.NETWORK_EVM_DISPLAY, - trackAnalyticsEvent: () => void 0, + trackAnalyticsEvent(params: Record): void { + if (typeof fathom === 'undefined') { + console.warn(`Failed to track event with ID ${params.id}: Fathom Analytics not loaded`); + return; + } + + const id = params.id as string; + fathom.trackGoal(id, 0); + }, getRPCEndpoint: () => { // extract the url parts const regex = /^(https?):\/\/([^:/]+)(?::(\d+))?(\/.*)?$/; From 5466970c87ff01c4599ad6e3066d81fcabd7e35a Mon Sep 17 00:00:00 2001 From: Ezra Sowden-Guzman Date: Tue, 2 Jan 2024 16:58:54 -0500 Subject: [PATCH 2/5] only load fathom for telos --- src/App.vue | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/App.vue b/src/App.vue index 6a5794d53..3c670a318 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,18 +1,23 @@