Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
feat: add page view to telemetry
Andrew Bastin36745d79db4c
diff --git a/helpers/fb/analytics.ts b/helpers/fb/analytics.tsindex 27d0aa4f4..d3471aacc 100644--- a/helpers/fb/analytics.ts+++ b/helpers/fb/analytics.ts@@ -91,3 +91,11 @@ export function logHoppRequestRunToAnalytics(ev: HoppRequestEvent) {analytics.logEvent("hopp-request", ev)}}++export function logPageView(pagePath: string) {+ if (settingsStore.value.TELEMETRY_ENABLED) {+ analytics.logEvent("page_view", {+ page_path: pagePath,+ })+ }+}diff --git a/layouts/default.vue b/layouts/default.vueindex e03c71b72..f862cac51 100644--- a/layouts/default.vue+++ b/layouts/default.vue@@ -20,8 +20,14 @@ import { initUserInfo } from "~/helpers/teams/BackendUserInfo"import { registerApolloAuthUpdate } from "~/helpers/apollo"import { initializeFirebase } from "~/helpers/fb"import { getSettingSubject } from "~/newstore/settings"+import { logPageView } from "~/helpers/fb/analytics"export default {+ watch: {+ $route(to) {+ logPageView(to.fullPath)+ },+ },beforeMount() {registerApolloAuthUpdate()@@ -35,7 +41,6 @@ export default {},async mounted() {performMigrations()-console.log("%cWe ❤︎ open source!","background-color:white;padding:8px 16px;border-radius:8px;font-size:32px;color:red;"@@ -71,6 +76,8 @@ export default {initializeFirebase()initUserInfo()++ logPageView(this.$router.currentRoute.fullPath)},beforeDestroy() {document.removeEventListener("keydown", this._keyListener)