Back to Installation Guides

Add heatm.app to your Laravel application

Follow these steps to integrate heatm.app analytics into your Laravel application.

Add tracking script to your Laravel app

Add the tracking script to your Laravel application in your main layout:


1. Open your `resources/views/layouts/app.blade.php` file

2. Add the script to the `<head>` section:

Code
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>{{ config('app.name', 'Laravel') }}</title>
    
    <!-- Add heatm.app tracking script -->
    <script
      defer
      data-website-id="YOUR_WEBSITE_ID"
      data-domain="your_domain.com"
      src="https://heatm.app/js/script.v2.min.js"
    ></script>
</head>
<body>
    <div id="app">
        @yield('content')
    </div>
</body>
</html>
!

Replace `YOUR_WEBSITE_ID` with your actual Website ID from heatm.app. Replace `your_domain.com` with your website's root domain.

Verify installation

After implementing:


  • Visit your live website
  • Check your heatm.app dashboard for incoming data
  • It might take a few minutes for the first pageviews to appear

For advanced configuration options like localhost tracking, custom API endpoints, or cross-domain setup, see the script configuration reference.