pub struct Session { /* private fields */ }Expand description
Per-visitor tracking state with automatic Umami cache reuse.
A session is cheap to clone; clones share cache state. Construct a separate session for each visitor when using the crate in a multi-user server.
Implementations§
Source§impl Session
impl Session
Sourcepub fn context(self, context: Context) -> Self
pub fn context(self, context: Context) -> Self
Replaces the context inherited by new tracks in this session.
Sourcepub fn distinct_id(self, distinct_id: impl Into<String>) -> Self
pub fn distinct_id(self, distinct_id: impl Into<String>) -> Self
Sets a stable distinct ID and clears any cache derived for the previous identity.
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> Self
pub fn user_agent(self, user_agent: impl Into<String>) -> Self
Sets the original visitor user agent.
Sourcepub fn hostname(self, hostname: impl Into<String>) -> Self
pub fn hostname(self, hostname: impl Into<String>) -> Self
Sets the hostname inherited by new tracks.
Sourcepub fn language(self, language: impl Into<String>) -> Self
pub fn language(self, language: impl Into<String>) -> Self
Sets the language inherited by new tracks.
Sourcepub fn pageview(&self, url: impl Into<String>) -> Track
pub fn pageview(&self, url: impl Into<String>) -> Track
Creates a pageview track in this session.
Sourcepub fn event(&self, name: impl Into<String>) -> Track
pub fn event(&self, name: impl Into<String>) -> Track
Creates a named custom-event track in this session.
Sourcepub fn identify(&self, distinct_id: impl Into<String>) -> Track
pub fn identify(&self, distinct_id: impl Into<String>) -> Track
Creates an identify track and assigns a stable distinct ID.
Sourcepub fn identify_anonymous(&self) -> Track
pub fn identify_anonymous(&self) -> Track
Creates an identify track without assigning a distinct ID.
Sourcepub fn performance(&self, url: impl Into<String>) -> Track
pub fn performance(&self, url: impl Into<String>) -> Track
Creates a Core Web Vitals performance track in this session.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
impl Freeze for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
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
Mutably borrows from an owned value. Read more