pub struct Event { /* private fields */ }Expand description
An Event represents an interaction a user has with your app or
website. Examples include button clicks, pageviews, query completions, and signups.
See the PostHog documentation
for a detailed explanation of PostHog Events.
Implementations§
Source§impl Event
impl Event
Sourcepub fn new<S: Into<String>>(event: S, distinct_id: S) -> Self
pub fn new<S: Into<String>>(event: S, distinct_id: S) -> Self
Capture a new identified Event. Unless you have a distinct ID you can
associate with a user, you probably want to use [new_anon] instead.
Sourcepub fn new_anon<S: Into<String>>(event: S) -> Self
pub fn new_anon<S: Into<String>>(event: S) -> Self
Capture a new anonymous event. See https://posthog.com/docs/data/anonymous-vs-identified-events#how-to-capture-anonymous-events
Sourcepub fn insert_prop<K: Into<String>, P: Serialize>(
&mut self,
key: K,
prop: P,
) -> Result<(), Error>
pub fn insert_prop<K: Into<String>, P: Serialize>( &mut self, key: K, prop: P, ) -> Result<(), Error>
Add a property to the event
Errors if prop fails to serialize
Sourcepub fn add_group(&mut self, group_name: &str, group_id: &str)
pub fn add_group(&mut self, group_name: &str, group_id: &str)
Capture this as a group event. See https://posthog.com/docs/product-analytics/group-analytics#how-to-capture-group-events Note that group events cannot be personless, and will be automatically upgraded to include person profile processing if they were anonymous. This might lead to “empty” person profiles being created.
Trait Implementations§
impl Eq for Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.