ActionLab Analytics for Laravel
Add privacy-first, AI-powered analytics to your Laravel site in under 60 seconds. No cookies, no consent banners, no complex setup.
Setup at a Glance
Add ActionLab to Laravel in 4 simple steps. Copy one script tag, paste it into your project, and start collecting privacy-friendly analytics immediately.
About Laravel
Laravel is the most popular PHP framework, powering a vast ecosystem of web applications, APIs, and full-stack projects. Its Blade templating engine, Eloquent ORM, and ecosystem packages (Livewire, Inertia.js, Jetstream) make it versatile for everything from simple sites to complex SaaS applications. ActionLab integrates through Blade templates with environment-based configuration, following Laravel conventions for external service integration.
Why Add Analytics to Laravel
Laravel developers follow conventions for configuration management, and ActionLab integration follows those conventions with .env configuration and Blade template inclusion. For Laravel applications using Inertia.js (which creates SPA-like navigation), ActionLab automatic navigation tracking means no additional Inertia middleware or event listeners are needed for analytics. The zero-dependency approach means no Composer package to install, no service provider to register, and no middleware to add — just a script tag in the Blade layout with environment-configured site ID.
Installation Code
{{-- resources/views/layouts/app.blade.php --}}
<head>
<script
src="https://cdn.actionlabanalytics.com/actionlab.js"
data-site="{{ config('services.actionlab.site_id') }}"
defer
></script>
</head>Step-by-Step Setup
- 1
Add the ActionLab script to your Blade layout template (resources/views/layouts/app.blade.php or equivalent).
- 2
Add ACTIONLAB_SITE_ID to your .env file with your actual site ID value.
- 3
Register the configuration in config/services.php: 'actionlab' => ['site_id' => env('ACTIONLAB_SITE_ID')].
- 4
The script works with standard Blade pages, Livewire components, and Inertia.js SPA navigation.
Why Use ActionLab with Laravel
- Environment-configurable via .env file, following Laravel standard pattern for external service credentials.
- Works with Blade templates, Livewire interactive components, and Inertia.js SPA navigation seamlessly.
- No Laravel package or Composer dependency needed — the Blade template integration is sufficient.
- Inertia.js SPA navigation is tracked automatically via History API detection, covering both Vue and React adapters.
Frequently Asked Questions
Does ActionLab work with Laravel Inertia?
Yes. ActionLab detects client-side route changes for Inertia.js (both Vue and React adapters) and tracks them as pageviews automatically. Inertia uses the History API for navigation, which ActionLab monitors. No Inertia middleware, shared data, or event listeners are needed for analytics tracking.
Does ActionLab work with Livewire?
Yes. Livewire components render and update within existing pages without full page reloads. ActionLab tracks the initial page load, and for Livewire SPA mode (wire:navigate), navigation between pages is tracked via History API detection. No Livewire-specific configuration needed.
Can I conditionally load ActionLab by environment?
Yes. Use Blade conditionals: @production ... @endproduction to load the script only in production. Or use @env('production') for more specific environment control. This prevents local development traffic from appearing in your analytics.
Does ActionLab work with Laravel Breeze and Jetstream?
Yes. Both Breeze and Jetstream use Blade layouts (or Inertia layouts) where you can add the ActionLab script tag. The analytics work identically regardless of which Laravel starter kit you use.
Can I fire custom events from Laravel Blade?
Yes. Add ActionLab custom event JavaScript calls in your Blade templates using @push('scripts') or inline script tags. Events can be triggered by form submissions, button clicks, or any client-side interaction.