Install on Laravel
Add the tag to the Blade layout every page extends, so server-rendered views all carry it.
Laravel apps render from one or two Blade layouts. Put the tag in each of them and every view inherits it.
Where it goes
Open resources/views/layouts/app.blade.php and paste the tag inside <head>.
<head>
<meta charset="utf-8">
@vite(['resources/css/app.css', 'resources/js/app.js'])
<script defer data-website-id="ws_XXXXXXXX" data-domain="yourstartup.com" src="https://statsy.co/js/script.js"></script>
</head>Keep the site key in the template or in a config value. It is a public key: it is visible in the page source of every site that uses Statsy, so it does not need to be a secret.
Confirm it works
Deploy and open the site, then check Live. Local development on localhost is not counted in production, so test against the real domain.
Check the other layouts
Most Laravel apps grow a second layout: guest.blade.php for sign-in pages, a marketing layout, a mail layout. Only the file you edited reports. Grep resources/views/layouts for <head> and add the tag wherever a real page is rendered. With Livewire or Inertia, navigation goes through the History API and is tracked without extra code.
Last updated · Markdown version