---
title: "Solid and SolidStart"
description: "Initialize from a root component with onMount. Solid runs onMount once in the browser and skips it during server rendering."
documentation: "https://tracwell.app/docs/frameworks/solid"
markdown: "https://tracwell.app/docs/frameworks/solid.md"
---

# 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

```ts
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 component or service that owns the successful product outcome. Call `track()` only after that outcome completes.

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

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

See the [custom events guide](https://tracwell.app/docs/events.md) for naming, property limits, and verification.
