diff --git a/crates/server/src/routes/organizations.rs b/crates/server/src/routes/organizations.rs index 69b286c2..94abea39 100644 --- a/crates/server/src/routes/organizations.rs +++ b/crates/server/src/routes/organizations.rs @@ -5,6 +5,7 @@ use axum::{ response::Json as ResponseJson, routing::{delete, get, patch, post}, }; +use deployment::Deployment; use utils::{ api::{ organizations::{ @@ -95,6 +96,15 @@ async fn create_organization( let response = client.create_organization(&request).await?; + deployment + .track_if_analytics_allowed( + "organization_created", + serde_json::json!({ + "org_id": response.organization.id.to_string(), + }), + ) + .await; + Ok(ResponseJson(ApiResponse::success(response))) } @@ -130,6 +140,17 @@ async fn create_invitation( let response = client.create_invitation(org_id, &request).await?; + deployment + .track_if_analytics_allowed( + "invitation_created", + serde_json::json!({ + "invitation_id": response.invitation.id.to_string(), + "org_id": org_id.to_string(), + "role": response.invitation.role, + }), + ) + .await; + Ok(ResponseJson(ApiResponse::success(response))) } diff --git a/crates/server/src/routes/projects.rs b/crates/server/src/routes/projects.rs index 14bcc92e..e87573d8 100644 --- a/crates/server/src/routes/projects.rs +++ b/crates/server/src/routes/projects.rs @@ -182,6 +182,15 @@ async fn apply_remote_project_link( let current_user_id = current_profile.as_ref().map(|p| p.user_id); link_shared_tasks_to_project(pool, current_user_id, project_id, remote_project.id).await?; + deployment + .track_if_analytics_allowed( + "project_linked_to_remote", + serde_json::json!({ + "project_id": project_id.to_string(), + }), + ) + .await; + Ok(updated_project) }