Skip to content

Commit a570127

Browse files
feat: allow user actions' tracking in MS Clarity (#872)
add env var P_MS_CLARITY_TAG with MS Clarity Tag The value will be available in the about API response if added About API Response json structure - ` { "version": "v1.3.0", "uiVersion": "development", "commit": "e581c10", "deploymentId": "01J4722F68X8XQVYT55TRG6R29", "updateAvailable": false, "latestVersion": "v1.3.0", "llmActive": false, "llmProvider": null, "oidcActive": false, "license": "AGPL-3.0-only", "mode": "Standalone", "staging": "/Users/nikhilsinha/Parseable/parseable/staging", "cache": "Disabled", "grpcPort": 8001, "store": { "type": "Local drive", "path": "/Users/nikhilsinha/Parseable/parseable/data" }, "analytics": { "clarityTag": "testtag" } } `
1 parent e581c10 commit a570127

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

server/src/cli.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ pub struct Cli {
107107

108108
///maximum disk usage allowed
109109
pub max_disk_usage: f64,
110+
111+
pub ms_clarity_tag: Option<String>,
110112
}
111113

112114
impl Cli {
@@ -142,6 +144,7 @@ impl Cli {
142144
pub const CORS: &'static str = "cors";
143145
pub const HOT_TIER_PATH: &'static str = "hot-tier-path";
144146
pub const MAX_DISK_USAGE: &'static str = "max-disk-usage";
147+
pub const MS_CLARITY_TAG: &'static str = "ms-clarity-tag";
145148

146149
pub fn local_stream_data_path(&self, stream_name: &str) -> PathBuf {
147150
self.local_staging_path.join(stream_name)
@@ -423,6 +426,14 @@ impl Cli {
423426
.help("Maximum allowed disk usage in percentage e.g 90.0 for 90%")
424427
.next_line_help(true),
425428
)
429+
.arg(
430+
Arg::new(Self::MS_CLARITY_TAG)
431+
.long(Self::MS_CLARITY_TAG)
432+
.env("P_MS_CLARITY_TAG")
433+
.value_name("STRING")
434+
.required(false)
435+
.help("Tag for MS Clarity"),
436+
)
426437
.group(
427438
ArgGroup::new("oidc")
428439
.args([Self::OPENID_CLIENT_ID, Self::OPENID_CLIENT_SECRET, Self::OPENID_ISSUER])
@@ -566,6 +577,8 @@ impl FromArgMatches for Cli {
566577
.cloned()
567578
.expect("default for max disk usage");
568579

580+
self.ms_clarity_tag = m.get_one::<String>(Self::MS_CLARITY_TAG).cloned();
581+
569582
Ok(())
570583
}
571584
}

server/src/handlers/http/about.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub async fn about() -> Json<serde_json::Value> {
9494
)
9595
};
9696

97-
let send_analytics = CONFIG.parseable.send_analytics;
97+
let ms_clarity_tag = &CONFIG.parseable.ms_clarity_tag;
9898

9999
Json(json!({
100100
"version": current_version,
@@ -115,6 +115,9 @@ pub async fn about() -> Json<serde_json::Value> {
115115
"type": CONFIG.get_storage_mode_string(),
116116
"path": store_endpoint
117117
},
118-
"sendAnalytics": send_analytics
118+
"analytics": {
119+
"clarityTag": ms_clarity_tag
120+
}
121+
119122
}))
120123
}

0 commit comments

Comments
 (0)