Convert Figma logo to code with AI

microsoft logoclarity

A behavioral analytics library that uses dom mutations and user interactions to generate aggregated insights.

2,102
212
2,102
273

Top Related Projects

19,798

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!

21,449

🦔 PostHog provides open-source product analytics, session recording, feature flagging and A/B testing that you can self-host.

Quick Overview

Microsoft Clarity is an open-source analytics tool that provides insights into user behavior on websites. It offers features like session recordings, heatmaps, and custom tagging to help developers and site owners understand how users interact with their web pages, identify usability issues, and optimize user experience.

Pros

  • Free to use with no limits on websites or pageviews
  • Provides detailed user behavior insights through session recordings and heatmaps
  • Easy to integrate with a simple JavaScript snippet
  • GDPR compliant and respects user privacy

Cons

  • Limited integration options compared to some other analytics tools
  • May impact website performance slightly due to additional script loading
  • Lacks some advanced features found in paid analytics solutions
  • Relatively new compared to established analytics platforms

Getting Started

To start using Microsoft Clarity, follow these steps:

  1. Sign up for a free account at https://clarity.microsoft.com/
  2. Create a new project for your website
  3. Add the provided JavaScript snippet to your website's HTML, just before the closing </head> tag:
<script type="text/javascript">
    (function(c,l,a,r,i,t,y){
        c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
        t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
        y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
    })(window, document, "clarity", "script", "YOUR_PROJECT_ID");
</script>

Replace YOUR_PROJECT_ID with the actual project ID provided by Clarity.

  1. Wait for data to start appearing in your Clarity dashboard (usually within 24 hours)

Competitor Comparisons

19,798

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!

Pros of Matomo

  • Open-source and self-hosted, offering full control over data and privacy
  • More comprehensive analytics features, including e-commerce tracking and goal conversions
  • Highly customizable with a plugin system and API for extending functionality

Cons of Matomo

  • Requires more technical expertise to set up and maintain
  • May have higher resource requirements for self-hosting
  • Less focus on visual heatmaps and session replays compared to Clarity

Code Comparison

Matomo (PHP):

$tracker = new MatomoTracker($idSite = 1, 'http://example.org/matomo/');
$tracker->doTrackPageView('Page Title');

Clarity (JavaScript):

clarity("set", "page_view", {
    page_name: "Page Title"
});
clarity("send", "pageview");

Both projects offer tracking capabilities, but Matomo's code is server-side PHP, while Clarity uses client-side JavaScript. Matomo's approach allows for more control and accuracy in data collection, while Clarity's method is easier to implement for most website owners.

Matomo provides a more comprehensive analytics solution with greater customization options, but requires more technical knowledge to set up and maintain. Clarity offers a simpler, cloud-based solution with a focus on visual insights, making it more accessible for users who prioritize ease of use over complete data control.

21,449

🦔 PostHog provides open-source product analytics, session recording, feature flagging and A/B testing that you can self-host.

Pros of PostHog

  • Open-source and self-hostable, offering more control over data and customization
  • Provides a broader suite of product analytics tools, including feature flags and session recording
  • Active community and frequent updates

Cons of PostHog

  • May require more technical expertise to set up and maintain
  • Can be resource-intensive for large-scale deployments
  • Less focus on specific website behavior tracking compared to Clarity

Code Comparison

PostHog:

posthog.init('<YOUR_PROJECT_API_KEY>', {
  api_host: 'https://app.posthog.com'
})

posthog.capture('button_clicked', { button_color: 'blue' })

Clarity:

(function(c,l,a,r,i,t,y){
    c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
    t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
    y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "<YOUR_PROJECT_ID>");

PostHog offers more flexibility in tracking custom events, while Clarity focuses on automatic tracking of user behavior. PostHog's initialization is simpler, but Clarity's script is designed for easy integration into existing websites.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Clarity

Clarity is an open-source behavioral analytics library written in typescript, with two key goals: privacy & performance.

It helps you understand how users view and use your website across all modern devices and browsers. Understanding how users navigate, interact and browse your website can provide new insights about your users. Empathizing with your users and seeing where features fail or succeed can help improve your product, grow revenue and improve user retention.

It's the same code that powers Microsoft's hosted behavioral analytics solution: https://clarity.microsoft.com. If you would like to see a demo of how it works, checkout live demo.

We encourage the community to join us in building the best behavioral analytics library, that puts privacy first and prioritizes performance.

Project Structure

  1. clarity-js: Instrumentation code that goes on the website and tracks user interactions as well as layout changes.

  2. clarity-decode: Code, which usually runs on the server, decodes incoming data back into its original format.

  3. clarity-visualize: It takes the decoded data from clarity-decode and turns it back into pixel-perfect session replay.

  4. clarity-devtools: Devtools extension for chromium based browsers to generate live captures against any website.

Examples

Here are some example sessions on popular websites visualized to demonstrate the telemetry captured:

  1. CNN (Web)

  2. Cook with Manali (Mobile)

Privacy Notice

Clarity handles sensitive data with care. By default sensitive content on the page is masked before uploading to the server. Additionally, Clarity offers several masking configuration options to ensure you are in full control of your data.

Improving Clarity

If you haven't already done so, start contributing by following instructions here.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Happy coding!

NPM DownloadsLast 30 Days