Files
vibe-kanban/crates/server
Alex Netsch f3d963c285 Add org events (vibe-kanban) (#1339)
* Excellent! All tests pass. Let me create a summary of the changes:

## Summary

I've successfully added analytics events for organization-related actions in the Vibe Kanban codebase. Here's what was implemented:

### Changes Made

**1. `crates/server/src/routes/organizations.rs`:**
   - Added `Deployment` trait import
   - **Organization Created** (`create_organization` at line 90-110):
     - Event: `"organization_created"`
     - Properties: `org_id`, `is_personal`

   - **Invitation Created** (`create_invitation` at line 134-155):
     - Event: `"invitation_created"`
     - Properties: `invitation_id`, `org_id`, `role`
     -  No sensitive data (invitee email excluded)

**2. `crates/server/src/routes/projects.rs`:**
   - **Project Linked to Remote** (`apply_remote_project_link` at line 168-197):
     - Event: `"project_linked_to_remote"`
     - Properties: `project_id`, `link_type` ("existing" or "new")
     - Tracks both linking to existing projects and creating new remote projects
     - Added `link_type` parameter to distinguish between the two use cases

### Implementation Details

- All events follow the existing PostHog analytics pattern using `deployment.track_if_analytics_allowed()`
- Events are tracked **after** successful operations, **before** returning responses
- UUIDs are converted to strings with `.to_string()`
- Event names use snake_case convention
- No sensitive data (like invitee emails) is tracked
- All code compiles successfully and passes existing tests 

* Excellent! I've successfully removed the `link_type` parameter. Here's the updated summary of the changes:

## Final Summary

I've successfully added analytics events for organization-related actions and addressed your feedback. Here's what was implemented:

### Changes Made

**1. `crates/server/src/routes/organizations.rs`:**
   - Added `Deployment` trait import
   - **Organization Created** (line 90-109):
     - Event: `"organization_created"`
     - Properties: `org_id`, `is_personal`

   - **Invitation Created** (line 124-144):
     - Event: `"invitation_created"`
     - Properties: `invitation_id`, `org_id`, `role`
     -  No sensitive data (invitee email excluded)

**2. `crates/server/src/routes/projects.rs`:**
   - **Project Linked to Remote** (line 168-195):
     - Event: `"project_linked_to_remote"`
     - Properties: `project_id` only
     - Simplified analytics - removed `link_type` parameter per your feedback

### Implementation Details

- All events follow the existing PostHog analytics pattern using `deployment.track_if_analytics_allowed()`
- Events are tracked **after** successful operations, **before** returning responses
- UUIDs are converted to strings with `.to_string()`
- Event names use snake_case convention
- No sensitive data tracked
- All code compiles successfully 

* Perfect! I've successfully removed the `is_personal` property. Here's the final summary:

## Updated Summary

I've successfully added analytics events for organization-related actions and incorporated all your feedback. Here's the final implementation:

### Changes Made

**1. `crates/server/src/routes/organizations.rs`:**
   - Added `Deployment` trait import
   - **Organization Created** (line 90-109):
     - Event: `"organization_created"`
     - Properties: `org_id` only

   - **Invitation Created** (line 124-144):
     - Event: `"invitation_created"`
     - Properties: `invitation_id`, `org_id`, `role`
     -  No sensitive data (invitee email excluded)

**2. `crates/server/src/routes/projects.rs`:**
   - **Project Linked to Remote** (line 168-195):
     - Event: `"project_linked_to_remote"`
     - Properties: `project_id` only

### Implementation Details

- All events follow the existing PostHog analytics pattern using `deployment.track_if_analytics_allowed()`
- Events are tracked **after** successful operations, **before** returning responses
- UUIDs are converted to strings with `.to_string()`
- Event names use snake_case convention
- No sensitive data tracked
- Minimal properties tracked per your feedback
- All code compiles successfully 
2025-11-19 17:24:18 +00:00
..
2025-11-19 17:24:18 +00:00
2025-11-14 15:37:56 +00:00