Microsoft Clarity Integration for Laravel

The clarity-laravel package lets you easily integrate Microsoft Clarity into your Laravel application. I wasn't familiar with Clarity before seeing this package—it's a GDPR and CCPA-ready product that you embed in your application, and it can capture how people use your site:

Heatmaps with Microsoft Clarity
Heatmaps with Microsoft Clarity

The main features that Clarity offers your application include:

Integration is easy with this package: you set up a few environment variables and include the package's Blade component in your application's layout file:

<head>
    <x-clarity::script />
</head>

This package will enable Clarity based on the CLARITY_ENABLED environment variable value in the clarity.php configuration file. If setting the environment variable isn't flexible enough, you can set the :enabled property on the component with a variable boolean value that you define:

<x-clarity::script :enabled="$enabled" />

While you could easily integrate the Clarity embed code in your application directly, this package takes care of it for you, and you can start collecting data in minutes. You can learn more about this package, get full installation instructions, and view the source code on GitHub. You can learn more about Clarity from the Microsoft Clarity documentation. You can also see a live demo


The post Microsoft Clarity Integration for Laravel appeared first on Laravel News.

Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.