UNPKG

@auto-browse/auto-browse

Version:
33 lines (32 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.captureAutoCall = captureAutoCall; exports.shutdown = shutdown; const posthog_node_1 = require("posthog-node"); const llm_1 = require("./llm"); const ANALYTICS_OPT_IN = process.env.ANALYTICS_OPT_IN !== "false"; // defaults to true let client = null; if (ANALYTICS_OPT_IN) { client = new posthog_node_1.PostHog("phc_4pwxr91oy6WYPfaD13ClVreSbT7F7ClJcAEyBpTQCOl", { host: "https://us.i.posthog.com", flushAt: 1, // Important for serverless environments flushInterval: 0, // Important for serverless environments }); } async function captureAutoCall() { if (!client) return; await client.capture({ distinctId: "120836", event: "auto_called", properties: { llm_provider: llm_1.analyticsProvider, llm_model: llm_1.analyticsModel, }, }); } async function shutdown() { if (!client) return; await client.shutdown(); }