Skip to content

Commit

Permalink
Add some backend posthog behavioral events (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
nichochar authored Oct 21, 2024
1 parent 2840e8e commit 1b96568
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/api/server/http.mts
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ router.options('/apps/:id/edit', cors());
router.post('/apps/:id/edit', cors(), async (req, res) => {
const { id } = req.params;
const { query, planId } = req.body;
posthog.capture({ event: 'user edited app with ai' });
try {
const app = await loadApp(id);

Expand Down Expand Up @@ -723,6 +724,7 @@ router.post('/apps/:id/export', cors(), async (req, res) => {
const { name } = req.body;

try {
posthog.capture({ event: 'user exported app' });
const app = await loadApp(id);

if (!app) {
Expand Down Expand Up @@ -765,6 +767,7 @@ router.post('/apps/:id/feedback', cors(), async (req, res) => {
if (process.env.SRCBOOK_DISABLE_ANALYTICS === 'true') {
return res.status(403).json({ error: 'Analytics are disabled' });
}
posthog.capture({ event: 'user sent feedback', properties: { type: feedback.type } });

try {
const response = await fetch('https://hub.srcbook.com/api/app_generation_feedback', {
Expand Down

0 comments on commit 1b96568

Please sign in to comment.