Skip to main content

TDAnalytics

Struct TDAnalytics 

Source
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

Source

pub fn new(consumer: impl Consumer + 'static) -> Result<Self>

Create an analytics instance delegating delivery to consumer.

Source

pub fn consumer(&self) -> &Arc<dyn Consumer> ⓘ

The injected consumer.

Source

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.

Source

pub fn super_properties(&self) -> Map<String, Value>

Snapshot of the currently registered super properties.

Source

pub fn clear_super_properties(&self)

Remove every registered super property.

Source

pub fn set_dynamic_super_properties<F, P>(&self, action: F)
where F: Fn() -> P + Send + Sync + 'static, P: IntoPropertyMap,

Register a callback producing dynamic common properties. It is evaluated once per event, outside of any lock; avoid heavy work in it.

Source

pub fn dynamic_super_properties(&self) -> Map<String, Value>

Snapshot of the dynamic super properties.

Source

pub fn track( &self, account_id: &str, event_name: &str, properties: impl IntoPropertyMap, ) -> Result<()>

Report an ordinary event attributed to account_id.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn user_set( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>

Set user properties, overwriting existing values.

Source

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.

Source

pub fn user_set_once( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>

Set user properties only where they were not set before.

Source

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.

Source

pub fn user_add( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>

Accumulate numeric user properties.

Source

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.

Source

pub fn user_append( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>

Append values to array-typed user properties.

Source

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.

Source

pub fn user_uniq_append( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>

Append unique values to array-typed user properties.

Source

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.

Source

pub fn user_unset<S: AsRef<str>>( &self, account_id: &str, keys: &[S], ) -> Result<()>

Clear the listed user properties.

Source

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.

Source

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).

Source

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.

Source

pub fn user_del(&self, account_id: &str) -> Result<()>

Delete the user; this operation cannot be undone.

Source

pub fn user_del_with_distinct_id( &self, account_id: &str, distinct_id: &str, ) -> Result<()>

Delete the user with explicit account and distinct IDs.

Source

pub fn user_del_with_properties( &self, account_id: &str, properties: impl IntoPropertyMap, ) -> Result<()>

Delete the user together with final property values.

Source

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.

Source

pub fn flush(&self) -> Result<()>

Deliver everything currently buffered by the consumer.

Source

pub fn close(&self) -> Result<()>

Flush and shut the consumer down.

Trait Implementations§

Source§

impl Clone for TDAnalytics

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more