Mountain/Binary/Build/PostHogPlugin/
CaptureEvent.rs1#![allow(non_snake_case)]
2
3use crate::Binary::Build::PostHogPlugin::{CaptureAllowed, Client, DistinctId};
8
9pub fn Fn(EventName:&str, Properties:Option<Vec<(&str, &str)>>) {
10 if !CaptureAllowed::Fn() {
11 return;
12 }
13
14 let Some(C) = Client::CLIENT.get() else { return };
15
16 let mut Event = posthog_rs::Event::new(EventName, &DistinctId::Fn());
17
18 let _ = Event.insert_prop("$app", "land-editor");
19 let _ = Event.insert_prop("$app_version", "0.0.1");
20 let _ = Event.insert_prop("$build_mode", "debug");
21 let _ = Event.insert_prop("$component", "mountain");
22
23 if let Some(Props) = Properties {
24 for (Key, Value) in Props {
25 let _ = Event.insert_prop(Key, Value);
26 }
27 }
28
29 let _ = C.capture(Event);
30}