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-wasmAdd 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.