Files
zeekay e43ab1afe7 chore: rename all PostHog references to Insights/Hanzo
Bulk rename across 989 files:
- Package names: posthog-js → @hanzo/insights, posthog-node → @hanzo/insights-node, etc.
- Repository URLs: posthog/posthog-js → hanzoai/insights-js
- Brand names: PostHog → Insights
- File renames: 259 reference JSON files, source files, workflow files
- Directory rename: eslint-plugin-posthog-js → eslint-plugin-insights

Remaining: 8 refs to @posthog/rrweb-* (real npm deps, need fork+publish)
2026-03-06 01:41:12 -08:00

37 lines
1008 B
JavaScript

/* eslint-disable no-undef */
/* eslint-disable @typescript-eslint/no-require-imports */
const functions = require('@google-cloud/functions-framework')
const { Insights } = require('insights-node')
const insights = new Insights(process.env.INSIGHTS_PROJECT_API_KEY, {
// works as well if you uncomment the following lines
// flushAt: 1,
// flushInterval: 0
})
insights.debug(true)
async function sendEvent(id) {
// works as well if you uncomment the following line, and comment the global insights declaration
// const insights = new Insights('phc_pQ70jJhZKHRvDIL5ruOErnPy6xiAiWCqlL4ayELj4X8')
// insights.debug(true)
insights.capture({
distinctId: 'test',
event: 'test' + id,
})
await insights.flush()
}
functions.http('helloWorld', async (req, res) => {
console.info('Insights before hello')
res.send('Hello, World')
console.info('Insights before send event')
await sendEvent(req.executionId)
console.info('Insights end')
})