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
20 let _ = Event.insert_prop("$app_version", "0.0.1");
21
22 let _ = Event.insert_prop("$build_mode", "debug");
23
24 let _ = Event.insert_prop("$component", "mountain");
25
26 if let Some(Props) = Properties {
27 for (Key, Value) in Props {
28 let _ = Event.insert_prop(Key, Value);
29 }
30 }
31
32 let _ = C.capture(Event);
33}