Skip to content

Commit

Permalink
rum init clean
Browse files Browse the repository at this point in the history
  • Loading branch information
fabis94 committed Mar 11, 2024
1 parent 2ab8437 commit be078da
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/frontend-2/plugins/002-rum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { Plugin } from 'nuxt/dist/app/nuxt'
type PluginNuxtApp = Parameters<Plugin>[0]

async function initRumClient() {
const { enabled, keys, speckleServerVersion, baseUrl } = resolveInitParams()
const { enabled, keys } = resolveInitParams()
const router = useRouter()
const onAuthStateChange = useOnAuthStateChange()
const registerErrorTransport = useCreateErrorLoggingTransport()
Expand All @@ -15,14 +15,6 @@ async function initRumClient() {
// RayGun
const rg4js = window.rg4js
if (keys.raygun && rg4js) {
rg4js('apiKey', keys.raygun)
rg4js('enableCrashReporting', true)
rg4js('enablePulse', true)
rg4js('withTags', [`baseUrl:${baseUrl}`, `version:${speckleServerVersion}`])
rg4js('options', {
debugMode: !!process.dev
})

router.afterEach((to) => {
rg4js('trackEvent', {
type: 'pageView',
Expand Down Expand Up @@ -70,7 +62,7 @@ async function initRumClient() {

async function initRumServer(app: PluginNuxtApp) {
const registerErrorTransport = useCreateErrorLoggingTransport()
const { enabled, keys } = resolveInitParams()
const { enabled, keys, baseUrl, speckleServerVersion } = resolveInitParams()
if (!enabled) return

// RayGun
Expand Down Expand Up @@ -103,6 +95,14 @@ async function initRumServer(app: PluginNuxtApp) {
f.async=1,f.src=d,g.parentNode.insertBefore(f,g),h=a.onerror,a.onerror=function(b,c,d,f,g){
h&&h(b,c,d,f,g),g||(g=new Error(b)),a[e].q=a[e].q||[],a[e].q.push({
e:g})}}(window,document,"script","//cdn.raygun.io/raygun4js/raygun.min.js","rg4js");`
},
{
innerHTML: `
rg4js('apiKey', '${keys.raygun}')
rg4js('enableCrashReporting', true)
rg4js('enablePulse', true)
rg4js('withTags', ['baseUrl:${baseUrl}', 'version:${speckleServerVersion}'])
`
}
]
})
Expand Down

0 comments on commit be078da

Please sign in to comment.