pub struct Client { /* private fields */ }Expand description
Async client for Umami’s unauthenticated analytics ingestion API.
The client is cheap to clone and is stateless, making it safe to share
across visitors. Use Client::session when sending a sequence of tracks
for one visitor and you want automatic cache reuse.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(
instance_url: impl Into<String>,
website_id: impl ToString,
) -> Result<Self>
pub fn new( instance_url: impl Into<String>, website_id: impl ToString, ) -> Result<Self>
Creates a client for a self-hosted Umami instance.
instance_url may be the instance root (https://analytics.example.com),
its API root (https://analytics.example.com/api), or the exact send
endpoint (https://analytics.example.com/api/send).
Sourcepub fn cloud(website_id: impl ToString) -> Result<Self>
pub fn cloud(website_id: impl ToString) -> Result<Self>
Creates a client for Umami Cloud’s public collection gateway.
Sourcepub fn builder(
instance_url: impl Into<String>,
website_id: impl ToString,
) -> ClientBuilder
pub fn builder( instance_url: impl Into<String>, website_id: impl ToString, ) -> ClientBuilder
Starts a configurable client builder.
Sourcepub fn website_id(&self) -> Uuid
pub fn website_id(&self) -> Uuid
Returns the configured website ID.
Sourcepub fn batch_endpoint(&self) -> &Url
pub fn batch_endpoint(&self) -> &Url
Returns the batch collection endpoint.
Sourcepub fn default_context(&self) -> &Context
pub fn default_context(&self) -> &Context
Returns the default context inherited by new tracks.
Sourcepub fn identify(&self, distinct_id: impl Into<String>) -> Track
pub fn identify(&self, distinct_id: impl Into<String>) -> Track
Creates an identify track for a stable distinct ID.
Sourcepub fn identify_anonymous(&self) -> Track
pub fn identify_anonymous(&self) -> Track
Creates an identify track that associates properties 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.