Browse documentation

Solid and SolidStart

Initialize from a root component with onMount. Solid runs onMount once in the browser and skips it during server rendering.

Initialize Tracwell

src/components/tracwell-analytics.tsx
import { onMount } from "solid-js";
import { createTracwell } from "tracwell";

export function TracwellAnalytics() {
  onMount(() => {
    createTracwell({
      collectionMode: "product",
      projectKey: "tw_live_...",
    });
  });

  return null;
}
Render the component once in the root application or SolidStart layout. Standard router navigation is captured automatically.

Track an event

Keep the initialized client available to the components or services that own successful product outcomes, then call track() after the outcome completes.

TypeScript
const eventId = analytics.track("signup_completed", {
  plan: "starter",
  source: "pricing",
});

if (!eventId) {
  // Collection is blocked or the event did not pass validation.
}

Continue with the custom events guide for naming, property limits, and verification.