Skip to main content

webserver_base/analytics/
mod.rs

1//! First-party proxies for Plausible and the Sentry browser SDK.
2//!
3//! Both vendors' own origins are on blocklists, and a blocked request is a
4//! visitor you never counted or an error you never saw. Serving their scripts
5//! and receiving their payloads from this origin makes the traffic
6//! same-origin, which is what Plausible themselves recommend.
7//!
8//! Nothing here interprets a payload — see [`proxy`] for why that matters.
9
10mod config;
11#[cfg(test)]
12mod fake_upstream;
13mod ip;
14mod proxy;
15mod retry;
16
17pub use config::{
18    AnalyticsConfig, ENV_ANALYTICS_ID, ENV_SENTRY_BROWSER_DSN, PLAUSIBLE_HOST,
19    SENTRY_BROWSER_CDN_HOST, SENTRY_BROWSER_SDK_VERSION, SentryDsn, SentryDsnParseError,
20};
21pub use ip::{CLIENT_IP_HEADERS, resolve_true_client_ip_address};
22pub use proxy::{ScriptRelay, relay_envelope, relay_event, relay_script};