pub struct PlausibleAnalytics { /* private fields */ }Expand description
Site analytics through the Plausible Stats API v2 (spec 3.5 §7.12, §7.13): cookieless, open source, hosted or self-hosted, the privacy-respecting default of §13 Q4’s external analytics.
The API key comes from the credential broker and is sent only over https (or http
on loopback). A filter’s key is a Plausible dimension such as event:page or
visit:source, matched with is.
§Example
use adk_drivers::analytics::{AnalyticsDriver, MetricQuery, PlausibleAnalytics};
let plausible = PlausibleAnalytics::new("https://plausible.io", "bakery.example", key)?;
let now = chrono::Utc::now();
let visitors = plausible.metric(&MetricQuery::new("visitors", now - chrono::Duration::days(7), now)).await?;Implementations§
Source§impl PlausibleAnalytics
impl PlausibleAnalytics
Sourcepub fn new(base: &str, site: &str, key: impl Into<String>) -> Result<Self>
pub fn new(base: &str, site: &str, key: impl Into<String>) -> Result<Self>
The site site (its domain as Plausible knows it) on the Plausible instance at
base, read with API key key.
§Errors
Returns DriverError::Invalid for an address that is not https (or http on
loopback) or an empty site or key.
Trait Implementations§
Source§impl AnalyticsDriver for PlausibleAnalytics
impl AnalyticsDriver for PlausibleAnalytics
Auto Trait Implementations§
impl !RefUnwindSafe for PlausibleAnalytics
impl !UnwindSafe for PlausibleAnalytics
impl Forget for PlausibleAnalytics
impl Freeze for PlausibleAnalyticswhere
*const ArcInner<ClientRef> is !null: Freeze,
PhantomData<ArcInner<ClientRef>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
impl Move for PlausibleAnalytics
impl Send for PlausibleAnalytics
impl Sync for PlausibleAnalytics
impl Unpin for PlausibleAnalytics
impl UnsafeUnpin for PlausibleAnalyticswhere
*const ArcInner<ClientRef> is !null: UnsafeUnpin,
PhantomData<ArcInner<ClientRef>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more