docs/.vitepress/theme/composables/op.ts
21 lines · 498 bytes
1import type { App, InjectionKey } from 'vue'
2import { Internal } from '../internal/browser'
3
4export const opSymbol: InjectionKey<Internal> = Symbol('op')
5
6export function createOpProvider(app: App) {
7 // Disable in dev
8 if (import.meta.env.DEV) return
9
10 const op = new Internal({
11 clientId: 'e0e39d6b-2692-45a0-9422-4d668f113f70',
12 trackScreenViews: true,
13 trackOutgoingLinks: true,
14 trackAttributes: true,
15 trackHashChanges: true
16 })
17
18 op.init()
19
20 app.provide(opSymbol, op)
21}