import { clarity } from "react-microsoft-clarity";
// Start seeing data on the Clarity dashboard with your project ID
clarity.init(id);
// Identify the user
clarity.identify("USER_ID", "SESSION_ID", "PAGE_ID");
// Cookie consent
clarity.consent();
// Setup a custom tag
clarity.setTag("key", "value");
// Upgrade session
clarity.upgrade("upgradeReason");
// Check if Clarity has been initialized before calling its methods
if (clarity.hasStarted()) {
clarity.identify("USER_ID", "SESSION_ID", "PAGE_ID", "FRIENDLY_NAME");
clarity.setEvent("SOME_EVENT");
}
id: Stands for "Classary ID" - 在设置中发现了您站点的项目ID. 这是告诉Clarity应该装入哪个站点以及应该保存所收集数据的ID.