jeffersongoncalves/laravel-hotjar
Integrates Hotjar tracking into Laravel applications, letting you inject the Hotjar snippet and configure your site ID from a single config file. Simple to install and works with any Blade or Livewire app.
composer require <vendor>/<package>:^1.1 — this is a minor release, so no code changes are required to keep existing behaviour. Existing <script> output is unchanged when no nonce is configured.Vite::useCspNonce($nonce) (or the @cspNonce Blade directive when you generate the nonce in a view).script-src (typically via laravel-security-headers or your own middleware) and the package's inline/embedded <script> was being blocked or forcing you to keep 'unsafe-inline'. After the upgrade, drop 'unsafe-inline' from script-src and confirm the package's tags render with nonce="…".<script> tags should carry the same nonce value as the ones emitted by @vite.nonce=" on the package's script tag, and run a curl -sI / curl -s against a staging URL with your real security headers to confirm no Refused to execute inline script in the browser console.laravel-security-headers's built-in support) and register it via Vite::useCspNonce($nonce) early — before any view that includes the package renders. The package reads the registered value, so you should never pass a nonce into the package manually.Route::middleware('web') view rendering). With laravel-security-headers, keep it in the global stack and verify it still runs when you use withoutMiddleware in tests.<script> tags, but the Content-Security-Policy header must contain the same value. Both must come from the same per-request nonce — mismatches are the most common cause of "it works locally, breaks in staging".@vite-adjacent partial, or a Blade component is fine; injecting the script client-side (e.g. building it in JS from JSON props) is not covered by this release.@cache, the nonce is baked into the cached HTML and will be wrong for the next request. Either exclude the package's partial from fragment caching or add the nonce to your cache key.Vite::useCspNonce('test-nonce') is set, and one asserting no nonce attribute (or no breakage) when it isn't. This pins the behaviour across future upgrades.@vite in dev mode, Vite's HMR scripts also pick up the nonce, so a correct setup means all scripts on the page share the value — a quick way to eyeball whether the nonce plumbing is consistent.script-src 'nonce-…' 'strict-dynamic' and remove 'unsafe-inline'; report-only (Content-Security-Policy-Report-Only) first is the low-risk path.Vite::useCspNonce() runs after the view renders (e.g. in a terminating middleware or a response callback), the package's tags will be emitted without a nonce. Set it in middleware, not in a listener.laravel-security-headers config not published, or the CSP disabled for that route group) means correctly-nonced scripts still get blocked. Check both, not just the HTML.Vite::useCspNonce() more than once per request overwrites the previous value; whichever is last wins for both @vite and the package. Keep exactly one call site.<script> blocks, onclick handlers, and style attributes still need their own nonces/hashes (or @cspNonce).composer show <vendor>/<package> and a one-line curl | grep -o 'nonce="[^"]*"'; if nothing renders, you may be on a cached view (php artisan view:clear) or an older lockfile entry.How can I help you explore Laravel packages today?