Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 2.66 KB

File metadata and controls

38 lines (26 loc) · 2.66 KB
# PostHog post-wizard report

The wizard has completed a deep integration of PostHog analytics into Gold Butterfly's server-side edge functions. Two Deno edge functions — the AI strategy analysis endpoint and the daily trading agent tick — now capture key business events using posthog-node via Deno's npm: import system. Each function initializes a short-lived PostHog client (flushAt: 1, flushInterval: 0) so events are sent immediately before the response is returned. User identification is performed on every authenticated strategy analysis request. Exceptions are captured via captureException in all error handlers, with enableExceptionAutocapture: true set on the client.

Event Description File
strategy_analysis_requested User requests AI strategy analysis for an options symbol functions/strategy-analysis.ts
strategy_analysis_completed AI strategy analysis successfully completed and returned strategies functions/strategy-analysis.ts
agent_position_opened Trading agent opened a new options position after daily tick functions/trading-tick.ts
agent_position_closed Trading agent closed an existing options position after daily tick functions/trading-tick.ts
agent_tick_completed Trading agent daily tick completed with position decisions for all agents functions/trading-tick.ts

Next steps

We've built some insights and a dashboard for you to keep an eye on user behavior, based on the events we just instrumented:

Environment variables

Set the following environment variables in your InsForge project settings so the edge functions can reach PostHog:

  • POSTHOG_API_KEY — your PostHog project API key
  • POSTHOG_HOSThttps://us.i.posthog.com

These are already written to your local .env file for the Node.js context.

Agent skill

We've left an agent skill folder in your project. You can use this context for further agent development when using Claude Code. This will help ensure the model provides the most up-to-date approaches for integrating PostHog.