Install the package and add the starter code for your platform. This is the same code Setup and npx @sansavision/apphelm init give you, with your own ids filled in.
Next.js
Install:
npminstall @sansavision/apphelm
Environment:
NEXT_PUBLIC_APPHELM_KEY=<your browser key, ahl_pub_…>
APPHELM_API_KEY=<your server key, ahl_live_…>
NEXT_PUBLIC_APPHELM_KEY: Browser key. Public by design: it only sends events from the origins you allowed for it.
APPHELM_API_KEY: Server key. Keep it secret: server environment only, never in browser code, an app binary or git.
A client component that starts the browser SDK. The browser SDK sends nothing until the visitor gives analytics consent: call setConsent({ analytics: true }) from your consent banner (or pass consent in the options when you have it already).
Server-side events (route handlers, server actions). Reads the server key from the environment; never import this file from a client component.
lib/apphelm.ts
// Server only: never import this file from a client component.import{ Apphelm }from"@sansavision/apphelm";exportconst apphelm = new Apphelm({
apiKey: process.env.APPHELM_API_KEY!,
workspaceId:"org_…",
productId:"prd_…",});// await apphelm.capture({ distinctId: user.id, event: "signup_completed" });
Check: Load a page (or run the code) once, then press Check connection: the first event appears within a few seconds.
React
Install:
npminstall @sansavision/apphelm
Environment:
VITE_APPHELM_KEY=<your browser key, ahl_pub_…>
VITE_APPHELM_KEY: Browser key. Public by design: it only sends events from the origins you allowed for it.
Wrap your app in the provider (merge into your entry file). With Create React App use process.env.REACT_APP_APPHELM_KEY instead. The browser SDK sends nothing until the visitor gives analytics consent: call setConsent({ analytics: true }) from your consent banner (or pass consent in the options when you have it already).
Check: Load a page (or run the code) once, then press Check connection: the first event appears within a few seconds.
Vue / Nuxt
Install:
npminstall @sansavision/apphelm
Environment:
VITE_APPHELM_KEY=<your browser key, ahl_pub_…>
VITE_APPHELM_KEY: Browser key. Public by design: it only sends events from the origins you allowed for it.
Import it once from src/main.ts (Nuxt: a client-only plugin, plugins/apphelm.client.ts, reading useRuntimeConfig().public.apphelmKey). The browser SDK sends nothing until the visitor gives analytics consent: call setConsent({ analytics: true }) from your consent banner (or pass consent in the options when you have it already).
Check: Load a page (or run the code) once, then press Check connection: the first event appears within a few seconds.
Svelte / SvelteKit
Install:
npminstall @sansavision/apphelm
Environment:
VITE_APPHELM_KEY=<your browser key, ahl_pub_…>
VITE_APPHELM_KEY: Browser key. Public by design: it only sends events from the origins you allowed for it.
Import it once from your root layout in the browser only (SvelteKit: src/routes/+layout.svelte inside onMount, reading PUBLIC_APPHELM_KEY from $env/static/public). The browser SDK sends nothing until the visitor gives analytics consent: call setConsent({ analytics: true }) from your consent banner (or pass consent in the options when you have it already).
Check: Load a page (or run the code) once, then press Check connection: the first event appears within a few seconds.
Plain HTML
Paste before
on every page. The browser key is public, so it can sit in the page. The browser SDK sends nothing until the visitor gives analytics consent: call setConsent({ analytics: true }) from your consent banner (or pass consent in the options when you have it already).
index.html
<scripttype="module">
import { createBrowserSdk } from "https://cdn.jsdelivr.net/npm/@sansavision/apphelm/dist/browser.js";
window.apphelm= createBrowserSdk({
key: "<your browser key, ahl_pub_…>",
workspaceId: "org_…",
productId: "prd_…",
});
// From your consent banner: window.apphelm.setConsent({ analytics: true });
</script>
Check: Load a page (or run the code) once, then press Check connection: the first event appears within a few seconds.
Node.js
Install:
npminstall @sansavision/apphelm
Environment:
APPHELM_API_KEY=<your server key, ahl_live_…>
APPHELM_API_KEY: Server key. Keep it secret: server environment only, never in browser code, an app binary or git.
Server-side events. Use your user id as distinctId so server and browser events join.
Add the package in Xcode (File → Add Package Dependencies) with the URL above, product Apphelm. The key ships inside the app: give it the events:write scope only.
Check: Run a track call once, then press Check connection.
Go
Install:
go get apphelm.dev/go@v0.8.1
Environment:
APPHELM_API_KEY=<your server key, ahl_live_…>
APPHELM_API_KEY: Server key. Keep it secret: server environment only, never in browser code, an app binary or git.
Server-side events, Go 1.21 or later, standard library only. Change the package name to put it elsewhere. If your network cannot reach the public Go proxy, set GOPROXY=https://apphelm.dev/packages/go,https://proxy.golang.org,direct (and GONOSUMDB=apphelm.dev/go if the checksum database is unreachable too).
apphelm.go
package main
import("os"
apphelm "apphelm.dev/go")// newApphelm creates the one client the app shares. In main://// client, err := newApphelm()// if err != nil {// log.Fatal(err)// }// defer client.Close() // sends what is still queued//// client.Capture(apphelm.Capture{DistinctID: user.ID, Event: "signup_completed"})func newApphelm()(*apphelm.Client, error){return apphelm.New(apphelm.Config{
APIKey: os.Getenv("APPHELM_API_KEY"),
WorkspaceID:"org_\u2026",
ProductID:"prd_\u2026",})}
Check: Run a Capture call once, then press Check connection.
Ruby
Add the package source first:
Add to your Gemfile, then run the install command. The source block makes Bundler take apphelm from apphelm.dev only, never from another source. Without Bundler: gem install apphelm --source https://apphelm.dev/packages/ruby
APPHELM_API_KEY: Server key. Keep it secret: server environment only, never in browser code, an app binary or git.
Server-side events, Ruby 3.1 or later. Rails loads config/initializers on boot; elsewhere, require this file once at startup. Thread-safe and fork-safe.
config/initializers/apphelm.rb
require"apphelm"
APPHELM = Apphelm::Client.new(
api_key: ENV.fetch("APPHELM_API_KEY"),
workspace_id:"org_\u{2026}",
product_id:"prd_\u{2026}")
at_exit { APPHELM.shutdown }# sends what is still queued# APPHELM.capture(distinct_id: user.id, event: "signup_completed")
Check: Run a capture call once, then press Check connection.
APPHELM_API_KEY: Server key. Keep it secret: server environment only, never in browser code, an app binary or git.
Server-side events, PHP 8.1 or later. Load Composer's vendor/autoload.php first (Laravel and Symfony already do). Each event is sent during the call that makes it; in a long-running worker (Octane, RoadRunner, Swoole) call $apphelm->flush() after each job or request.
APPHELM_KEY: Passed at build time: flutter run --dart-define=APPHELM_KEY=… (the same for flutter build). It ships inside the app, so anyone can extract it: give it the events:write scope only.
Set up once before runApp (merge into your main.dart). Pure Dart, so the same code runs on iOS, Android, web and desktop. Its dependencies (http, shared_preferences) still come from pub.dev.
lib/main.dart
import'package:flutter/material.dart';import'package:apphelm_flutter/apphelm_flutter.dart';
Future<void> main()async{
WidgetsFlutterBinding.ensureInitialized();await Apphelm.setup(ApphelmConfig(
apiKey:const String.fromEnvironment('APPHELM_KEY'),// events:write only
workspaceId:'org_\u{2026}',
productId:'prd_\u{2026}',));
runApp(const MyApp());// add ApphelmObserver() to your MaterialApp's navigatorObservers for screen views}// Apphelm.instance.track('signup_completed');
Check: Launch the app once, then press Check connection: $app_opened arrives first.
.NET
Install:
dotnet new nugetconfig # only if the solution has no nuget.config yet
dotnet nuget add source https://apphelm.dev/packages/nuget/index.json --name apphelm --configfile nuget.config
dotnet add package SansaVision.Apphelm
Environment:
APPHELM_API_KEY=<your server key, ahl_live_…>
APPHELM_API_KEY: Server key. Keep it secret: server environment only, never in browser code, an app binary or git.
Server-side events, .NET 8 or .NET Standard 2.0. Keep nuget.org in nuget.config too: the package depends on Microsoft packages from there. In ASP.NET Core, add SansaVision.Apphelm.AspNetCore and call builder.Services.AddApphelm(…) instead, which registers one client and flushes it when the host stops.
Program.cs
using Apphelm;// One client for the whole app. Disposing it sends what is still queued.awaitusingvar apphelm = new ApphelmClient(new ApphelmOptions
{
ApiKey = Environment.GetEnvironmentVariable("APPHELM_API_KEY")!,
WorkspaceId = "org_\u2026",
ProductId = "prd_\u2026",});// apphelm.Capture(user.Id, "signup_completed");
Check: Run a Capture call once, then press Check connection.
Elixir
Add the package source first:
Add to your deps. The repository must be named apphelm; its key fingerprint (mix hex.repo list) is SHA256:jokXz/stsZM7KS9JSjA27c12iygbBwVqIh7587t3NEs. jason and plug still come from hex.pm.
APPHELM_API_KEY: Server key. Keep it secret: server environment only, never in browser code, an app binary or git.
Server-side events, Elixir 1.14 or later. Merge into config/runtime.exs: with :api_key set, the :apphelm application starts the client itself. Add the repository in CI too, before mix deps.get.
Check: Start the app, run Apphelm.capture once, then press Check connection.
Rust
Add the package source first:
Names the apphelm.dev registry, in your project (or ~/.cargo/config.toml). Then the install command adds apphelm = { version = "0.8", registry = "apphelm" } to Cargo.toml; add features = ["async"] for tokio applications.
APPHELM_API_KEY: Server key. Keep it secret: server environment only, never in browser code, an app binary or git.
Server-side events, Rust 1.82 or later. Add mod apphelm_client; to main.rs, create the client at startup and clone it where you capture (clones share one queue).
src/apphelm_client.rs
use apphelm::{Client, Options};/// The one client the app shares. Call `shutdown()` before the process exits: it sends what is still queued.pubfn connect() -> Result<Client, Box<dyn std::error::Error>> {let options = Options::new(std::env::var("APPHELM_API_KEY")?).workspace_id("org_\u{2026}").product_id("prd_\u{2026}");Ok(Client::new(options)?)}// apphelm.capture(apphelm::Event::new(&user.id, "signup_completed"))?;
Check: Run a capture call once, then press Check connection.
HTTP
No SDK is needed to send events. Post them to the ingest API with a server key:
Use your app once (load a page, open a screen, or run the capture call), then press Check connection in Setup. It confirms the key, the environment, consent, masking and identity, and shows the first events as they land, usually within seconds.
Choose an outcome
Pick one event that means a user got value, such as signup_completed or order_paid. AppHelm measures funnels, experiments and insights against it.