| Crates.io | statsig-wasm |
| lib.rs | statsig-wasm |
| version | 0.2.0 |
| created_at | 2025-12-06 13:10:41.973553+00 |
| updated_at | 2026-01-13 13:59:04.131407+00 |
| description | Wasm bindings for the Statsig JavaScript (Web) SDK |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1970145 |
| size | 8,893 |
We're dsplce.co, check out our work on our website: dsplce.co ๐ค
๐ Wasm bindings for the Statsig JavaScript (Web) SDK.
In your project, run:
cargo add statsig-wasm
Add the following script to your HTML <head> tag to make Statsig available to your Wasm module:
<script
src="https://cdn.jsdelivr.net/npm/@statsig/js-client@3/build/statsig-js-client+session-replay+web-analytics.min.js"
crossorigin="anonymous"
>
</script>
Bear in mind, if you're happy for Statsig to autoinitialise the client, just append ?apikey=<YOUR_CLIENT_API_KEY> to the script's src above and uninstall this crate ๐
If you're looking to initialise the client yourself, read on.
Set a custom user ID and initialise the client:
use statsig_wasm::{StatsigClient, StatsigUser};
let statsig = StatsigClient::new(
env!("STATSIG_API_KEY"),
StatsigUser {
user_id: user_id.get(),
},
)
.unwrap();
run_statsig_auto_capture(&statsig);
// `spawn_local` is native to Leptos, use your
// framework's equivalent to run the async method.
spawn_local(async move {
statsig.initialize().await;
});
MIT or Apache-2.0, at your option.