abr4xas / clarity-laravel
Easy integration of Microsoft Clarity into your Laravel application.
Fund package maintenance!
angelcruz.dev/donate
Requires
- php: ^8.2
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.17
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.5
- pestphp/pest-plugin-laravel: ^2.0
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-04-29 23:21:14 UTC
README
Easy integration of Microsoft Clarity into your Laravel application.
Installation
You can install the package via composer:
composer require abr4xas/clarity-laravel
You can publish the config file with:
php artisan vendor:publish --tag="clarity-config"
This is the contents of the published config file:
<?php return [ 'id' => env('CLARITY_ID', 'XXXXXX'), 'enabled' => env('CLARITY_ENABLED', true), ];
Optionally, you can publish the views using
php artisan vendor:publish --tag="clarity-views"
Usage
- Create an account: The first thing you need to do is create an account on Microsoft Clarity. You can sign up on their website and follow the steps to create your account. Then, get your tracking code and that's it.
- Simply add the blade components to your base layout files.
The enabled
attribute is optional, but can be used to control the tags integration from blade files that extend the base layout. It accepts true/false
.
This can still be controlled globally via the .env
file should you need to disable the integration global on different environments as well.
<!-- Should be placed in the head --> <x-clarity::script :enabled="$enabled" />
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
This package is strongly inspired by Google Tag Manager for Laravel created by @awcodes.