1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! # Privatus Analytics for Rust
//!
//! Prints the cookieless [Privatus Analytics](https://privatusanalytics.com)
//! script tag, the attributes for custom events and click maps, and page
//! props, for Rust web apps.
//!
//! The crate only prints HTML for the browser. It never sends events or any
//! other request from your server, sets no cookies, and never reads IP
//! addresses, browser details (user agents) or any visitor id. The core has
//! no dependencies.
//!
//! ```
//! use privatus_analytics::{click_attr, event_attrs, props, Config};
//!
//! let config = Config::new().site_id("pa_YOURSITEID").enabled(true);
//!
//! assert_eq!(
//! config.tag().to_html().as_str(),
//! r#"<script defer src="https://privatusstats.com/js/pa.js" data-site="pa_YOURSITEID"></script>"#
//! );
//! assert_eq!(
//! event_attrs("Report exported", props! { "format" => "csv" }).as_str(),
//! r#"data-privatus-event="Report exported" data-privatus-prop-format="csv""#
//! );
//! assert_eq!(click_attr("pricing.cta").as_str(), r#"data-privatus-click="pricing.cta""#);
//! ```
//!
//! When [`Config::enabled`] is not set, the tag prints only in release builds
//! (`cfg!(not(debug_assertions))`).
//!
//! ## Cargo features
//!
//! * `axum`: [`axum::PrivatusLayer`], a tower layer that adds the tag to
//! HTML pages.
//! * `actix`: [`actix::PrivatusMiddleware`], the same for actix-web.
//! * `askama`: askama does not escape [`SafeHtml`] and [`Tag`].
//! * `maud`: [`SafeHtml`] and [`Tag`] implement `maud::Render`, plus
//! [`maud::element`].
//!
//! See the [README](https://github.com/Privatus-Analytics/rust) and the
//! [Privatus Analytics docs](https://privatusanalytics.com/docs).
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// The script tag for these settings. The same as [`Config::tag`].