Hassan 판매

Clarity is an open-source TypeScript behavioral analytics library that captures user interactions, decodes telemetry, and renders pixel-perfect session replays — with privacy-first masking and minimal performance overhead.
clarity-js is a TypeScript behavioral analytics instrumentation library that captures user interactions, layout changes, and performance data from web pages. It encodes and uploads telemetry payloads for later decoding and session replay. Target buyers are backend/fullstack engineers embedding privacy-first analytics into a web application without relying on a hosted SaaS SDK.
clarity.ts - Top-level lifecycle controller: start, stop, pause, resume, upgradeindex.ts - Package entry point; re-exports clarity, version, and helper utilitiesglobal.ts - Global state and shared referencesqueue.ts - Internal event queue and flush schedulingcore/ - Foundational utilities: config, hashing, history, task scheduling, time, throttle, reportingdata/ - Data pipeline: metadata, envelope, upload, compression, cookies, consent, metrics, variables, signalsdiagnostic/ - Fraud detection, script error monitoring, internal diagnosticsdynamic/agent/ - Live chat agent integrations (Crisp, LiveChat, Tidio)insight/ - Snapshot and blank-state captureinteraction/ - Pointer, click, scroll, resize, input, clipboard, selection, focus, submit eventslayout/ - DOM tracking, selector generation, node lookupperformance/ - Performance timing and resource metrics# clarity-js has no external runtime dependencies.
# Install the package itself for its type declarations if needed alongside source:
npm install user@example.com
No native modules, pod install, or Android linking steps are required. This is a pure TypeScript/browser library.
Copy source/ into your project, e.g. src/clarity-js/.
Add path aliases in tsconfig.json to match the internal import aliases used by the source:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@src/*": ["src/clarity-js/*"],
"@clarity-types/*": ["node_modules/clarity/types/*"]
}
}
}
격리된 샌드박스를 띄워 서버에서 바로 실행하세요 — 로컬 설정 불필요.
이 버전에 대한 Tetrees AI Review
This Express backend / api completed archive review. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
파이프라인 avcp-2026-08-04.1 · SHA-256 37a63cde1025afa5…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
검토일 2026년 8월 4일
이 제품을 AI IDE, 웹 빌더 또는 클라우드 IDE로 바로 가져오세요.
Tetrees를 호환 AI IDE에 연결해 보유 제품을 불러오고, 판매자 업로드 권한을 노출하지 않은 채 검증된 ZIP을 받으세요.
아직 리뷰가 없습니다.
토론을 불러오는 중…
{
"resolve": {
"alias": {
"@src": path.resolve(__dirname, "src/clarity-js"),
"@clarity-types": path.resolve(__dirname, "node_modules/clarity/types")
}
}
}
npm install user@example.com
The library runs in a browser context. It accesses window, document, navigator, performance, and MutationObserver. Do not import it in Node.js server-side code paths; gate it behind an typeof window !== "undefined" check.
No environment variables are required by the core library. Configuration is passed via the config() call (see Public API).
import { clarity } from "./src/clarity-js/index";
clarity.start(config?: Config): void
clarity.stop(): void
clarity.pause(): void
clarity.resume(): void
clarity.upgrade(key: string): void
clarity.version: string
The clarity namespace is the primary lifecycle handle. Call clarity.start() once the DOM is ready to begin capturing. Call clarity.stop() to end a session cleanly. upgrade signals an intent to escalate capture fidelity for the current session.
import { helper } from "./src/clarity-js/index";
helper.hash(value: string): string
helper.selector.getSelector(node: Node): string
helper.get(id: number): Node
helper.getNode(node: Node): number
helper.lookup(node: Node): number
helper bundles utilities for DOM introspection and hashing. Use helper.hash to produce the same deterministic hash that clarity uses internally for node fingerprinting. Use helper.selector.* to resolve CSS selectors for arbitrary DOM nodes in the same way clarity does.
import { config } from "./src/clarity-js/core/index";
config(override: Config): boolean
Apply configuration overrides before calling start(). Returns false if the session is already active or override is null. Accepts any subset of keys defined in Config (@clarity-types/core): upload URL, project ID, masking rules, sampling rate, etc.
import { check } from "./src/clarity-js/core/index";
check(): boolean
Returns true if the current browser environment satisfies all prerequisites (Promise, MutationObserver, TreeWalker, Date.now, performance.now, WeakMap) and Global Privacy Control is not set. Use this guard before calling start() to avoid errors in unsupported environments.
Initialize clarity as early as possible in your page bundle. Guard against unsupported browsers and Global Privacy Control before starting.
import { clarity, version } from "./src/clarity-js/index";
import { check, config } from "./src/clarity-js/core/index";
if (check()) {
config({
projectId: "your-project-id",
upload: "https://your-collector-endpoint.example.com/clarity",
lean: false,
});
clarity.start();
console.log("Clarity started, version:", version);
}
Use helper to replicate clarity's internal hashing logic when you need stable identifiers for DOM nodes in your own analytics pipeline.
import { helper } from "./src/clarity-js/index";
function getNodeFingerprint(node: Element): string {
const sel = helper.selector.getSelector(node);
const hash = helper.hash(sel);
return hash;
}
const button = document.querySelector("#submit-btn");
if (button) {
const id = getNodeFingerprint(button);
console.log("Stable node ID:", id);
}
In single-page applications, stop the session on route change and restart to capture page views as independent sessions.
import { clarity } from "./src/clarity-js/index";
import { check, config } from "./src/clarity-js/core/index";
function onRouteChange(newPath: string): void {
clarity.stop();
if (check()) {
config({
projectId: "your-project-id",
upload: "https://your-collector-endpoint.example.com/clarity",
});
clarity.start();
console.log("New clarity session started for:", newPath);
}
}
window.addEventListener("popstate", () => onRouteChange(location.pathname));
clarity.ts - Orchestrates module start/stop order; exposes the public lifecycle API.index.ts - Re-exports clarity, version, and helper; the package entry point.global.ts - Holds mutable global references shared across modules (window handle, document reference, etc.).queue.ts - Manages the internal async event queue and controls flush timing.core/api.ts - Internal API surface shared across core utilities.core/config.ts - Default configuration object and runtime overrides.core/copy.ts - Deep-copy utility for safe state snapshots.core/dynamic.ts - Handles dynamic module loading.core/event.ts - Event registry and dispatch within the core pipeline.core/hash.ts - Deterministic string hashing used for node and selector fingerprinting.core/history.ts - URL and navigation history tracking.core/index.ts - Core module lifecycle (start, stop, active, check, config).core/measure.ts - Performance measurement wrappers for internal profiling.core/report.ts - Internal error/diagnostic reporting.core/scrub.ts - PII scrubbing helpers.core/task.ts - Cooperative task scheduler using idle callbacks.core/throttle.ts - Rate-limiting utility.core/time.ts - Session-relative timestamp generation.core/timeout.ts - Safe setTimeout wrappers.core/version.ts - Exposes the library version string.data/ - Full data pipeline: envelope framing, upload, compression, consent, cookies, metrics, variables, dimensions, signals, pings, and summaries.diagnostic/ - Fraud heuristics, script error capture, and internal telemetry.dynamic/agent/ - Auto-detects and integrates with LiveChat, Tidio, and Crisp agents at startup.insight/ - Page snapshot and blank-state encoding.interaction/ - All user interaction event handlers (click, scroll, pointer, input, clipboard, resize, etc.).layout/ - DOM mutation observation, virtual node tree, and CSS selector generation.performance/ - Navigation timing and resource performance entries.window and document at module scope. Gate all imports behind typeof window !== "undefined" or lazy-import inside a useEffect / browser entry point.@clarity-types path not resolved: The type aliases must be configured in both tsconfig.json and your bundler. Missing one causes silent type errors or runtime crashes; add both alias entries.check() returns false due to Global Privacy Control: navigator.globalPrivacyControl === true causes check() to return false by design. Do not call start() in that case; respect the user's preference.config() after start(): config() returns false and applies no changes once the session is active. Always call config() before clarity.start().start() calls without stop(): The active() guard in core/index.ts prevents double-start, but event listeners accumulate if stop() is not called first on SPA navigation. Always pair stop() → start().@src for its own code, rename the alias in both tsconfig.json and your bundler config to something like @clarity-src and do a find-replace in the copied source files.I have copied the clarity-js instrumentation source into `src/clarity-js/` in my project.
The upstream package is `user@example.com`. I also have `USAGE.md` in the same directory.
Please help me integrate clarity-js step by step:
1. Read `USAGE.md` for the full API reference and project setup instructions.
2. Add the required `tsconfig.json` path aliases (`@src` -> `src/clarity-js`, `@clarity-types` -> `node_modules/clarity/types`).
3. Add equivalent aliases to my bundler config (Webpack / Vite / esbuild - ask me which I use).
4. Create an `analytics.ts` bootstrap module that:
- Imports `clarity`, `version`, and `helper` from `src/clarity-js/index`.
- Imports `check` and `config` from `src/clarity-js/core/index`.
- Guards initialization with `check()`.
- Applies config overrides (projectId, upload endpoint) before calling `clarity.start()`.
- Exports a `stopClarity` function for SPA route cleanup.
5. Wire the bootstrap module into my application entry point.
6. Show me how to use `helper.hash` and `helper.selector.getSelector` to fingerprint a DOM node.
7. Point out any pitfalls specific to my framework (ask me if it is Next.js, Remix, plain Webpack, etc.).
Use only the exports visible in USAGE.md. Do not invent new APIs.
The upstream project is released under the MIT License (see source/LICENSE if present, or verify at the clarity GitHub repository). This block is derived from user@example.com published by Microsoft. Original project: https://github.com/microsoft/clarity.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
전체 설치 가이드와 연동 프롬프트는 구매 후 열람할 수 있습니다.
Mobile App Templates & App Source Code
무료