# fluidattacks-tracks
[](https://crates.io/crates/fluidattacks-tracks)
<p align="center">
<a href="https://fluidattacks.com/" rel="noopener" target="_blank">
<img width="460px" src="https://res.cloudinary.com/fluid-attacks/image/upload/v1728418266/airs/logo/logo_full.png" alt="Fluid Attacks logo">
</a>
</p>
This library provides a convenient way to report usage analytics from any Rust application.
All publish operations run in a background thread, and errors are silently swallowed so that tracking failures never interrupt your application's normal flow.
## Usage
```toml
[dependencies]
fluidattacks-tracks = "0.1"
```
```rust
use chrono::Utc;
use fluidattacks_tracks::Tracks;
use fluidattacks_tracks::resources::event::{Action, Event, Mechanism};
let client = Tracks::new();
client.event.create(Event {
action: Action::Create,
author: "author@example.com".to_string(),
date: Utc::now(),
mechanism: Mechanism::Api,
metadata: fluidattacks_tracks::serde_json::json!({"foo": "bar"}),
object: "object".to_string(),
object_id: "object_id".to_string(),
author_anonymous: None,
author_ip: None,
author_role: None,
author_user_agent: None,
session_id: None,
});
```
The API endpoint is configured via the `FT_API_URL` environment variable, defaulting to `https://tracks.fluidattacks.com/`.