Choose your integration
Android Java
Android Java client for mobile apps using a public ingest key.
implementation "app.stactics:stactics-android:0.1.0"
import app.stactics.StacticsClient;
import java.util.Map;
StacticsClient stactics = new StacticsClient(
BuildConfig.STACTICS_PUBLIC_KEY
);
stactics.track(
"signup",
"user_123",
"production",
Map.of("plan", "free")
);
Angular
Angular provider and service wrapper around the JavaScript client.
npm install @stactics.io/angular @stactics.io/js
import { provideStactics } from "@stactics.io/angular";
bootstrapApplication(AppComponent, {
providers: [
provideStactics({
apiKey: "pk_...",
environment: "production"
})
]
});
Go
Backend Go client for trusted services, workers, and API integrations.
go get github.com/nexuindustries/stactics/sdks/go/stactics
package main
import (
"context"
"os"
stactics "github.com/nexuindustries/stactics/sdks/go/stactics"
)
func main() {
client := stactics.NewClient(os.Getenv("STACTICS_SECRET_KEY"))
_, _ = client.Track(context.Background(), "signup", stactics.Event{
UserID: "user_123",
EnvironmentID: "00000000-0000-0000-0000-000000000000",
Metadata: map[string]any{
"plan": "free",
},
})
}
JavaScript
Universal JavaScript client for browsers, Node, and framework apps.
npm install @stactics.io/js
import { StacticsClient, StacticsEvents } from "@stactics.io/js";
const stactics = new StacticsClient({
apiKey: "pk_..."
});
await stactics.trackEvent(StacticsEvents.signup({
userId: "user_123",
environmentId: "00000000-0000-0000-0000-000000000000",
metadata: { plan: "free" }
}));
Kotlin
Kotlin client for Android apps and JVM services using the public ingest API.
implementation("app.stactics:stactics-android:0.1.0")
import app.stactics.StacticsClient
val stactics = StacticsClient(
apiKey = BuildConfig.STACTICS_PUBLIC_KEY
)
fun trackSignup() {
stactics.track(
eventType = "signup",
userId = "user_123",
environmentId = "00000000-0000-0000-0000-000000000000",
metadata = mapOf("plan" to "free")
)
}
Next.js
Server-side route handler integration for Next.js apps using a secret ingest key.
npm install @stactics.io/js
import { StacticsClient, StacticsEvents } from "@stactics.io/js";
import { NextResponse } from "next/server";
const stactics = new StacticsClient({
apiKey: process.env.STACTICS_SECRET_KEY
});
export async function POST(request: Request) {
const body = await request.json();
await stactics.trackEvent(StacticsEvents.signup({
userId: body.userId,
environmentId: process.env.STACTICS_ENVIRONMENT_ID,
metadata: { plan: body.plan }
}));
return NextResponse.json({ ok: true });
}
React
Client-side React integration for browser apps using a public ingest key.
npm install @stactics.io/js
import { useMemo } from "react";
import { StacticsClient, StacticsEvents } from "@stactics.io/js";
export function SignupButton({ userId }) {
const stactics = useMemo(() => new StacticsClient({
apiKey: import.meta.env.VITE_STACTICS_PUBLIC_KEY
}), []);
async function trackSignup() {
await stactics.trackEvent(StacticsEvents.signup({
userId,
environmentId: import.meta.env.VITE_STACTICS_ENVIRONMENT_ID,
metadata: { source: "signup_button" }
}));
}
return <button onClick={trackSignup}>Create account</button>;
}
Ruby
Server-side Ruby client for Rails, jobs, and trusted backend integrations.
gem install stactics
require "stactics"
client = Stactics::Client.new(
api_key: ENV.fetch("STACTICS_SECRET_KEY")
)
client.track(
"signup",
user_id: "user_123",
environment_id: "00000000-0000-0000-0000-000000000000",
metadata: { plan: "free" }
)
Rust
Rust client for trusted backend services and jobs using a secret ingest key.
cargo add stactics
use stactics::{Client, Event};
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), stactics::Error> {
let client = Client::new(std::env::var("STACTICS_SECRET_KEY").unwrap());
client.track(Event::new("signup")
.user_id("user_123")
.environment_id("00000000-0000-0000-0000-000000000000")
.metadata(json!({ "plan": "free" })))
.await?;
Ok(())
}
Swift
Swift client for iOS and server-side Swift apps using public or secret ingest keys.
https://github.com/nexuindustries/stactics/tree/main/sdks/swift
import Stactics
let client = StacticsClient(
apiKey: ProcessInfo.processInfo.environment["STACTICS_PUBLIC_KEY"] ?? ""
)
Task {
try await client.track(
"signup",
userId: "user_123",
environmentId: "00000000-0000-0000-0000-000000000000",
metadata: ["plan": "free"]
)
}