Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
feat(glean): enable glean in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfluckey committed Nov 28, 2023
1 parent 49f2cef commit a9c10a9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions modules/glean/runtime/glean-plugin.client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Glean from '@mozilla/glean/web'
import * as log from 'tauri-plugin-log-api'

import { linkClick, pageUrl, pageView, referrerUrl } from '../../../telemetry/generated/web'
import { userAgent } from '../../../telemetry/generated/identifiers'
import { engagement } from '../../../telemetry/generated/ui'
import { engagementDetails } from '../../../telemetry/engagementDetails'
import { userAgent } from '~~/telemetry/generated/identifiers'
import { engagement } from '~~/telemetry/generated/ui'
import { engagementDetails } from '~~/telemetry/engagementDetails'
import { linkClick, pageUrl, pageView, referrerUrl } from '~~/telemetry/generated/web'

export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('app:mounted', () => {
Expand All @@ -13,9 +13,11 @@ export default defineNuxtPlugin((nuxtApp) => {
const GLEAN_APP_ID = 'moso-mastodon-web'
const env = useAppConfig().env
const devMode = env === ('dev' || 'canary' || 'preview')
const prodMode = env === 'release'
const gleanEnabled = (devMode || prodMode)
const userSettings = useUserSettings()
const allowGlean = getPreferences(userSettings.value, 'allowGlean')
const uploadEnabled = devMode && allowGlean
const userAllowGlean = getPreferences(userSettings.value, 'allowGlean')
const uploadEnabled = gleanEnabled && userAllowGlean

Glean.initialize(GLEAN_APP_ID, uploadEnabled, { channel: env })
userAgent.set(navigator.userAgent)
Expand Down

0 comments on commit a9c10a9

Please sign in to comment.