react-microsoft-clarity
Small component to implement Microsoft Clarity into your React Application
Installation
npm install react-microsoft-clarity --save
Use / Example
import { clarity } from 'react-microsoft-clarity';
clarity.init(id);
clarity.identify('USER_ID', { userProperty: 'value' });
clarity.consent();
clarity.stop();
clarity.start();
clarity.setTag('key', 'value');
clarity.setEvent("eventName");
clarity.upgrade('upgradeReason');
if (clarity.hasStarted()) {
clarity.identify('USER_ID', { userProperty: 'value' });
}
- id: Stands for 'Clarity ID' - Your site's ID. This is the ID which tells Clarity which site settings it should load and where it should save the data collected.
You can learn more from Clarity Docs