mirror of
https://github.com/voideditor/void
synced 2026-05-23 17:38:23 +00:00
move to posthog
This commit is contained in:
parent
0bf5278168
commit
e56716c792
2 changed files with 19 additions and 29 deletions
|
|
@ -13,25 +13,6 @@ import { AutocompleteProvider } from './AutcompleteProvider';
|
|||
import { runTreeSitter } from '../common/LangaugeServer/createJsProgramGraph';
|
||||
|
||||
|
||||
|
||||
const buildEnv = 'development';
|
||||
const buildNumber = '1.0.0';
|
||||
const isMac = process.platform === 'darwin';
|
||||
const commandKey = isMac ? '⌘' : 'Ctrl';
|
||||
const userLabel = buildEnv === 'development' ? 'Developer' : 'Production User';
|
||||
|
||||
function sendMetrics(event: string) {
|
||||
const metrics = {
|
||||
isMac,
|
||||
commandKey,
|
||||
event,
|
||||
buildNumber,
|
||||
userLabel,
|
||||
};
|
||||
console.log('Metrics:', metrics);
|
||||
}
|
||||
|
||||
|
||||
// // this comes from vscode.proposed.editorInsets.d.ts
|
||||
// declare module 'vscode' {
|
||||
// export interface WebviewEditorInset {
|
||||
|
|
@ -62,14 +43,6 @@ const getSelection = (editor: vscode.TextEditor) => {
|
|||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
|
||||
console.log(`Build Environment: ${buildEnv}`);
|
||||
console.log(`Build Number: ${buildNumber}`)
|
||||
console.log(`Use ${commandKey} for commands.`);
|
||||
console.log(`User Label: ${userLabel}`);
|
||||
|
||||
sendMetrics('extensionActivated');
|
||||
|
||||
// 1. Mount the chat sidebar
|
||||
const sidebarWebviewProvider = new SidebarWebviewProvider(context);
|
||||
context.subscriptions.push(
|
||||
|
|
|
|||
|
|
@ -1,12 +1,29 @@
|
|||
import posthog from 'posthog-js'
|
||||
|
||||
|
||||
|
||||
|
||||
const buildEnv = 'development';
|
||||
const buildNumber = '1.0.0';
|
||||
const isMac = process.platform === 'darwin';
|
||||
// TODO use commandKey
|
||||
const commandKey = isMac ? '⌘' : 'Ctrl';
|
||||
const systemInfo = {
|
||||
buildEnv,
|
||||
buildNumber,
|
||||
isMac,
|
||||
}
|
||||
|
||||
|
||||
export const identifyUser = (id: string) => {
|
||||
posthog.identify(id)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const captureEvent = (eventId: string, properties: object) => {
|
||||
posthog.capture(eventId, properties)
|
||||
posthog.capture(eventId, { ...properties, systemInfo })
|
||||
}
|
||||
|
||||
export const initPosthog = () => {
|
||||
|
|
@ -17,4 +34,4 @@ export const initPosthog = () => {
|
|||
person_profiles: 'identified_only' // we only track events from identified users. We identify them in Sidebar
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue