pub struct TDAnalytics { /* private fields */ }Expand description
The blocking analytics facade of the SDK, ported from the Go SDK’s
TDAnalytics.
It is cheap to clone; every clone shares the same consumer and super property state. See the crate documentation for a quick start.
Implementations§
Source§impl TDAnalytics
impl TDAnalytics
Sourcepub fn new(consumer: impl Consumer + 'static) -> Result<Self>
pub fn new(consumer: impl Consumer + 'static) -> Result<Self>
Create an analytics instance delegating delivery to consumer.
Sourcepub fn set_super_properties(
&self,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn set_super_properties( &self, properties: impl IntoPropertyMap, ) -> Result<()>
Set common properties applied to every subsequent track* event.
Keys are validated against the key pattern; an invalid key returns an error instead of silently corrupting the stream.
Sourcepub fn super_properties(&self) -> Map<String, Value>
pub fn super_properties(&self) -> Map<String, Value>
Snapshot of the currently registered super properties.
Sourcepub fn clear_super_properties(&self)
pub fn clear_super_properties(&self)
Remove every registered super property.
Sourcepub fn set_dynamic_super_properties<F, P>(&self, action: F)
pub fn set_dynamic_super_properties<F, P>(&self, action: F)
Register a callback producing dynamic common properties. It is evaluated once per event, outside of any lock; avoid heavy work in it.
Sourcepub fn dynamic_super_properties(&self) -> Map<String, Value>
pub fn dynamic_super_properties(&self) -> Map<String, Value>
Snapshot of the dynamic super properties.
Sourcepub fn track(
&self,
account_id: &str,
event_name: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn track( &self, account_id: &str, event_name: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Report an ordinary event attributed to account_id.
Sourcepub fn track_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
event_name: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn track_with_distinct_id( &self, account_id: &str, distinct_id: &str, event_name: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Report an ordinary event with explicit account and distinct IDs.
Sourcepub fn track_first(
&self,
account_id: &str,
event_name: &str,
first_check_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn track_first( &self, account_id: &str, event_name: &str, first_check_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Report a first-check event; first_check_id deduplicates it.
Sourcepub fn track_first_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
event_name: &str,
first_check_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn track_first_with_distinct_id( &self, account_id: &str, distinct_id: &str, event_name: &str, first_check_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Report a first-check event with explicit account and distinct IDs.
Sourcepub fn track_update(
&self,
account_id: &str,
event_name: &str,
event_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn track_update( &self, account_id: &str, event_name: &str, event_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Report an updatable event identified by event_id.
Sourcepub fn track_update_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
event_name: &str,
event_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn track_update_with_distinct_id( &self, account_id: &str, distinct_id: &str, event_name: &str, event_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Report an updatable event with explicit account and distinct IDs.
Sourcepub fn track_overwrite(
&self,
account_id: &str,
event_name: &str,
event_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn track_overwrite( &self, account_id: &str, event_name: &str, event_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Report an overridable event identified by event_id.
Sourcepub fn track_overwrite_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
event_name: &str,
event_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn track_overwrite_with_distinct_id( &self, account_id: &str, distinct_id: &str, event_name: &str, event_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Report an overridable event with explicit account and distinct IDs.
Sourcepub fn user_set(
&self,
account_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_set( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Set user properties, overwriting existing values.
Sourcepub fn user_set_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_set_with_distinct_id( &self, account_id: &str, distinct_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Set user properties with explicit account and distinct IDs.
Sourcepub fn user_set_once(
&self,
account_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_set_once( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Set user properties only where they were not set before.
Sourcepub fn user_set_once_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_set_once_with_distinct_id( &self, account_id: &str, distinct_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
user_set_once with explicit account and distinct IDs.
Sourcepub fn user_add(
&self,
account_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_add( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Accumulate numeric user properties.
Sourcepub fn user_add_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_add_with_distinct_id( &self, account_id: &str, distinct_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
user_add with explicit account and distinct IDs.
Sourcepub fn user_append(
&self,
account_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_append( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Append values to array-typed user properties.
Sourcepub fn user_append_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_append_with_distinct_id( &self, account_id: &str, distinct_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
user_append with explicit account and distinct IDs.
Sourcepub fn user_uniq_append(
&self,
account_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_uniq_append( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Append unique values to array-typed user properties.
Sourcepub fn user_uniq_append_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_uniq_append_with_distinct_id( &self, account_id: &str, distinct_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
user_uniq_append with explicit account and distinct IDs.
Sourcepub fn user_unset<S: AsRef<str>>(
&self,
account_id: &str,
keys: &[S],
) -> Result<()>
pub fn user_unset<S: AsRef<str>>( &self, account_id: &str, keys: &[S], ) -> Result<()>
Clear the listed user properties.
Sourcepub fn user_unset_with_distinct_id<S: AsRef<str>>(
&self,
account_id: &str,
distinct_id: &str,
keys: &[S],
) -> Result<()>
pub fn user_unset_with_distinct_id<S: AsRef<str>>( &self, account_id: &str, distinct_id: &str, keys: &[S], ) -> Result<()>
Clear the listed user properties with explicit account and distinct IDs.
Sourcepub fn user_unset_with_properties(
&self,
account_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_unset_with_properties( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Clear user properties using a property map (values are ignored by the receiver, but preset keys keep their values, matching the Lua SDK).
Sourcepub fn user_unset_with_properties_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_unset_with_properties_with_distinct_id( &self, account_id: &str, distinct_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
user_unset_with_properties with explicit account and distinct IDs.
Sourcepub fn user_del(&self, account_id: &str) -> Result<()>
pub fn user_del(&self, account_id: &str) -> Result<()>
Delete the user; this operation cannot be undone.
Sourcepub fn user_del_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
) -> Result<()>
pub fn user_del_with_distinct_id( &self, account_id: &str, distinct_id: &str, ) -> Result<()>
Delete the user with explicit account and distinct IDs.
Sourcepub fn user_del_with_properties(
&self,
account_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_del_with_properties( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
Delete the user together with final property values.
Sourcepub fn user_del_with_properties_with_distinct_id(
&self,
account_id: &str,
distinct_id: &str,
properties: impl IntoPropertyMap,
) -> Result<()>
pub fn user_del_with_properties_with_distinct_id( &self, account_id: &str, distinct_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>
user_del_with_properties with explicit account and distinct IDs.