# Add Privatus Analytics to Laravel

> Add cookieless analytics to a Laravel app with one snippet in your Blade layout wrapped in @production so local and test runs are not counted.

Add the snippet to your main Blade layout, for example
`resources/views/layouts/app.blade.php`, inside `<head>`:

```blade
@production
  <script defer src="https://privatusstats.com/js/pa.js" data-site="pa_YOURSITEID" data-modules="engage,auto,vitals,clicks,ask"></script>
@endproduction
```

`@production` is true when `APP_ENV` is `production`, so local and
staging runs are not counted. To include staging too, use
`@env(['staging', 'production'])` and `@endenv` instead.

If you use Inertia, the root template is
[`resources/views/app.blade.php`](/docs/install/inertia). Livewire and Blade
apps with full page loads count each page once.

## Keep the site id in config

```blade
@production
  <script defer src="https://privatusstats.com/js/pa.js" data-site="{{ config('services.privatus.site') }}" data-modules="engage,auto,vitals,clicks,ask"></script>
@endproduction
```

```php
// config/services.php
'privatus' => ['site' => env('PRIVATUS_SITE_ID')],
```

Run `php artisan config:cache` after you change the environment file on a
live server. Add other options as [attributes](/docs/tracker/attributes).
