abr4xas/clarity-laravel
A lightweight Laravel integration for Microsoft Clarity. Configure your Clarity project ID and the package injects the tracking script, with a Blade directive available, so you can add session recordings, heatmaps, and user behavior analytics with minimal setup and no manual snippets.
composer require abr4xas/clarity-laravel. v3 is a major bump driven by orchestra/testbench ^11.0 in CI, which tracks Laravel 13 — confirm your app's Laravel/PHP constraint with composer why-not abr4xas/clarity-laravel ^3.0 before upgrading. Apps on Laravel 11/12 should stay on v2 unless the constraint matrix says otherwise.php artisan vendor:publish --tag=clarity (list tags with php artisan vendor:publish if the tag name differs). You get config/clarity.php; set the Clarity Project ID (Clarity dashboard → Settings → Setup → Install manually) and the enable flag.config/clarity.php, then the service provider to see whether the snippet is injected globally, via middleware, or through a Blade directive. That determines everything downstream (consent, multi-tenant, CSP)..env (CLARITY_ID=), reference it as env('CLARITY_ID') in the config, disable injection in local/testing, then load any page and confirm the clarity.ms/tag/... script is in view-source. Then check the Clarity dashboard for a live session..env entry per environment; production gets the real ID, staging a separate project (or disabled), local/testing disabled.app()->isProduction() (or an explicit allowlist) so preview deployments and CI don't pollute your analytics with bot traffic.app.blade.php). Verify that client-side navigation doesn't re-inject the tag on every route change.CLARITY_ID to phpunit.xml as empty/disabled and assert presence in a single feature test (assertSee('clarity.ms', false)) so a config or provider regression fails loudly.config/clarity.php or .env, run php artisan config:clear (and re-cache on deploy). A stale cached config is silent.php artisan list clarity and confirm the refactored command's signature before wiring it into deploy scripts; arguments/options may have moved.response()->stream() endpoint — you don't want an analytics snippet appended to a file payload.https://www.clarity.ms, https://scripts.clarity.ms and Clarity's connect endpoints. Otherwise the tag loads, blocks silently, and you get no sessions with no error in the console beyond a CSP violation.php artisan about) → tag in view-source → requests to clarity.ms in the network tab → session visible in the dashboard (reporting lags by minutes, longer for aggregated views).How can I help you explore Laravel packages today?