Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

onboarding: Telemetry for new AI setup buttons (#55145)

Katie Geerbbeeab6dcf86
diff --git a/crates/onboarding/src/basics_page.rs b/crates/onboarding/src/basics_page.rs
index 4817e897f77..7d021c54447 100644
--- a/crates/onboarding/src/basics_page.rs
+++ b/crates/onboarding/src/basics_page.rs
@@ -528,7 +528,8 @@ fn render_import_settings_section(tab_index: &mut isize, cx: &mut App) -> impl I
.child(h_flex().gap_1().child(vscode).child(cursor))
}
-const FEATURED_AGENT_IDS: &[&str] = &["claude-acp", "codex-acp", "github-copilot-cli", "cursor"];
+pub(crate) const FEATURED_AGENT_IDS: &[&str] =
+ &["claude-acp", "codex-acp", "github-copilot-cli", "cursor"];
fn render_registry_agent_button(
agent: &RegistryAgent,
@@ -565,6 +566,7 @@ fn render_registry_agent_button(
.state(state_element)
.disabled(installed)
.on_click(move |_, _, cx| {
+ telemetry::event!("Welcome Agent Install Clicked", agent = agent_id.as_str());
let agent_id = agent_id.clone();
update_settings_file(fs.clone(), cx, move |settings, _| {
let agent_servers = settings.agent_servers.get_or_insert_default();
@@ -645,6 +647,7 @@ fn render_zed_agent_button(user_store: &Entity<UserStore>, cx: &mut App) -> impl
})
} else {
this.on_click(move |_, _, cx| {
+ telemetry::event!("Welcome Zed Agent Sign In Clicked");
let client = Client::global(cx);
cx.spawn(async move |cx| client.sign_in_with_optional_connect(true, cx).await)
.detach_and_log_err(cx);
diff --git a/crates/onboarding/src/onboarding.rs b/crates/onboarding/src/onboarding.rs
index ce9a383a606..652febbda49 100644
--- a/crates/onboarding/src/onboarding.rs
+++ b/crates/onboarding/src/onboarding.rs
@@ -1,5 +1,6 @@
use crate::multibuffer_hint::MultibufferHint;
use client::{Client, UserStore, zed_urls};
+use cloud_api_types::Plan;
use db::kvp::KeyValueStore;
use fs::Fs;
use gpui::{
@@ -8,6 +9,7 @@ use gpui::{
Subscription, Task, WeakEntity, Window, actions,
};
use notifications::status_toast::StatusToast;
+use project::agent_server_store::AllAgentServersSettings;
use schemars::JsonSchema;
use serde::Deserialize;
use settings::{SettingsStore, VsCodeSettingsSource};
@@ -216,6 +218,41 @@ impl Onboarding {
fn new(workspace: &Workspace, cx: &mut App) -> Entity<Self> {
let font_family_cache = theme::FontFamilyCache::global(cx);
+ let installed_agents = cx
+ .global::<SettingsStore>()
+ .get::<AllAgentServersSettings>(None)
+ .clone();
+ let client = Client::global(cx);
+ let status = *client.status().borrow();
+ let plan = workspace.user_store().read(cx).plan();
+ let zed_agent_state = if status.is_signed_out()
+ || matches!(
+ status,
+ client::Status::AuthenticationError | client::Status::ConnectionError
+ ) {
+ "signed_out"
+ } else if status.is_signing_in() {
+ "signing_in"
+ } else {
+ match plan {
+ Some(Plan::ZedPro) => "pro",
+ Some(Plan::ZedProTrial) => "trial",
+ Some(Plan::ZedBusiness) => "business",
+ Some(Plan::ZedStudent) => "student",
+ Some(Plan::ZedFree) | None => "free",
+ }
+ };
+ let agents_installed = basics_page::FEATURED_AGENT_IDS
+ .iter()
+ .filter(|id| installed_agents.contains_key(**id))
+ .copied()
+ .collect::<Vec<_>>();
+ telemetry::event!(
+ "Welcome Agent Setup Viewed",
+ zed_agent = zed_agent_state,
+ agents_installed = agents_installed,
+ );
+
cx.new(|cx| {
cx.spawn(async move |this, cx| {
font_family_cache.prefetch(cx).await;