[Docs](https://userjourney.dev/docs/) · Install

# Add UserJourney to a Laravel app

For Laravel with Blade layouts (Breeze, Jetstream or your own).

## 1. The snippet and identify

In your layout, for example `resources/views/layouts/app.blade.php`, in the `<head>`. Your key is on the Setup page of the dashboard. The first identify for someone is their sign-up.

```
<script src="https://userjourney.dev/uj.js" data-key="pk_…" defer></script>
@auth
  <script>
    addEventListener("DOMContentLoaded", () =>
      uj.identify({{ Js::from((string) auth()->id()) }}, {{ Js::from(['email' => auth()->user()->email, 'name' => auth()->user()->name]) }}))
  </script>
@endauth
```

## 2. Sign-out

```
<form method="POST" action="{{ route('logout') }}" onsubmit="window.uj && uj.reset()">
```

## 3. Onboarding steps

Pages under `/onboarding/<step>`, `/setup/<step>`, `/welcome/<step>` or `/get-started/<step>` count as steps by themselves. Steps that happen on the server go through the [server API](https://userjourney.dev/docs/#server):

```
Http::withToken(env('USERJOURNEY_SECRET_KEY'))->post('https://userjourney.dev/api/v1/server', [
    'u' => (string) $user->id,
    'e' => [['t' => 'step', 'n' => 'first_import']],
]);
```

## Payments

Connect [Stripe](https://userjourney.dev/docs/stripe/) or [Paddle](https://userjourney.dev/docs/paddle/) in the dashboard, and each payment, trial and cancellation lands on the person who made it.

## Check it works

Open your site in a private window: you show up on Traffic within a few seconds. Sign up with a test account and it appears on People, with the visit that brought it. Your own team is left out once you sign in; for your visits before that, open any page once with `?uj=off` ([more](https://userjourney.dev/docs/#leave-out)).

If your app sends a Content Security Policy, add `https://userjourney.dev` to `script-src` and `connect-src`.

[Everything else is in the docs →](https://userjourney.dev/docs/)

## See where your users go

Free for your first 250 users. One script and one line of code.

[Start for free](https://userjourney.dev/app)[Read the quickstart](https://userjourney.dev/docs/)
