# Switch by changing one URL

> Point posthog-js, Plausible's script or a Sentry SDK at Clearlook and keep your code.

If your site already sends data to PostHog, Plausible or Sentry, you don't need to rewrite anything. Point the code you have at Clearlook, and the same calls land here. Bring your history over with an [importer](/importers), then run both side by side for a week before you remove the old tool.

## From PostHog

Use your Clearlook write key (`pk_…`) as the project token, and Clearlook as the host:

```js
posthog.init('pk_live_…', { api_host: 'https://app.clearlook.dev' })
```

| What you call | What happens |
|---|---|
| `capture('Signed up', {...})` | A custom event with its properties |
| Pageviews and page leaves | Counted like Clearlook's own script |
| `identify('user_42', {...})` | Links the visitor to that person, with the traits |
| `group(...)` | Tags events with the account |
| Feature flags | Always off: `isFeatureEnabled` answers false, so your app carries on |
| Session recording, surveys, autocapture | Not taken; turn them off in `init`, or Clearlook ignores them |

The snippet install works too: it loads PostHog's library from PostHog's own servers. Tested with posthog-js 1.455.

## From Plausible

Keep Plausible's script or its npm tracker, and change only where it sends:

```html
<script defer data-domain="example.com" data-api="https://app.clearlook.dev/api/event" src="https://plausible.io/js/script.js"></script>
```

```js
init({ domain: 'example.com', endpoint: 'https://app.clearlook.dev/api/event' })
```

The domain must match the site's address in Clearlook. If it doesn't (or you'd rather not depend on it), add your write key: `https://app.clearlook.dev/api/event?key=pk_live_…`.

Pageviews, custom events, their properties and revenue all come in. Visits are counted without cookies, as Plausible does. The Events API takes the same body, so server-side calls work the same way. Tested with `@plausible-analytics/tracker` 0.4.7.

## From Sentry

Change only the DSN to the one in Settings › Errors. Every Sentry SDK keeps working: errors, stack traces, breadcrumbs, the release and the user. See [Errors](/errors).

## Ask your AI app to do it

Paste this into Claude Code, Cursor or any coding agent:

```text
Switch this app's analytics to Clearlook by changing only where it sends data: follow https://docs.clearlook.dev/switching. Keep every capture call as it is and show me the diff. Then open the site and check that its events arrive in Clearlook.
```
