How to Install Microsoft Clarity

You know your conversion rate dropped last week. You know visitors are abandoning their carts. You know something’s wrong with your checkout page. But Google Analytics 4 tells you what happened, not why it happened.

This is where Microsoft Clarity changes everything. It’s a free tool that shows you exactly what your visitors are doing on your site through session recordings and heatmaps. Instead of guessing why people leave, you can watch them struggle with that broken button or see them get confused by your navigation.

Table of Contents

Why Visual Analytics Actually Matters

Traditional analytics platforms excel at the numbers. GA4 will tell you that 500 people visited your checkout page, 200 of them bounced, and your average session duration was 1 minute and 32 seconds. All useful data. None of it explains the actual problem.

Here’s what those metrics can’t show you:

The user clicked your “Apply Coupon” button seven times before giving up because it wasn’t working. They scrolled up and down your pricing page three times looking for information that should have been obvious. They started filling out your contact form, paused for 30 seconds at the phone number field, then closed the tab.

Microsoft Clarity captures this reality. When you watch a session recording, you’re seeing the actual experience. When you look at a heatmap, you’re seeing where hundreds of users clicked, scrolled, and got stuck.

This guide walks you through the complete technical implementation. Not just which buttons to click, but how the system actually works, why certain installation methods are superior, and how to avoid the common mistakes that lead to incomplete data or broken tracking.

How Session Recording Actually Works

Before you install anything, you need to understand what’s happening under the hood. This knowledge becomes critical when you’re troubleshooting or making decisions about which installation method to use.

The Technology Behind the Recordings

Most people assume session recording tools capture video files of the user’s screen. If this were true, your website would grind to a halt. Video files are massive, and streaming them would require enormous bandwidth.

Microsoft Clarity uses something far more sophisticated. Here’s what actually happens when the Clarity script loads in someone’s browser.

First, it scans your website’s DOM (Document Object Model), which is the code structure of your page. Think of this as creating a text-based map of every button, image, text block, and form field on your site.

Then it starts watching for changes using the browser’s MutationObserver API. When a user opens a dropdown menu, the DOM changes. Clarity records this as an instruction: “Element #menu changed class from ‘hidden’ to ‘visible’.”

At the same time, it logs every user interaction (mouse movements, clicks, scrolls, keystrokes) as vector coordinates tied to those DOM elements.

When you watch a session recording later, the Clarity dashboard reconstructs your website using the stored assets and replays the mouse cursor movements based on those recorded coordinates. It’s essentially puppeting the cursor through a recreation of your site.

What This Means for Your Implementation

Because Clarity reconstructs the DOM, your installation method must give the script clean access to your page structure. This is why we strongly recommend Google Tag Manager over manual code insertion.

It also means certain website technologies require special attention. If your site uses heavy <iframe> elements or Canvas rendering that hides the DOM, standard installation might need adjustments.

Before You Start: What You Actually Need

You’ll need three things in place before beginning the technical deployment.

Google Tag Manager (The Gold Standard)

While you can install Clarity by pasting code directly into your website, we explicitly recommend Google Tag Manager (GTM) as your deployment method. Here’s why.

GTM acts as a container for all your tracking codes. This means you can add, remove, or modify tracking scripts without touching your website’s source code. No risk of accidentally breaking something. No need to wait for a developer. Everything is centralized with built-in version control.

This guide assumes you already have a functional GTM container installed on your website. If you don’t, you’ll need to set that up first or use one of the platform-specific methods we cover later.

The Right Access Levels

You’ll need appropriate permissions across three platforms:

Google Tag Manager: “Publish” level access so you can deploy the tag to your live site.

Your Website Platform: Administrative access to Shopify, WordPress, Wix, or whatever platform hosts your site.

Microsoft Account: You’ll need a Microsoft, Google, or Facebook account to create your Clarity project and generate credentials.

A Clear Understanding of Your Website Architecture

Know which platform your website runs on. Know if you use a Content Management System (CMS) like WordPress. Know if you have caching plugins installed. These details matter for troubleshooting.

Creating Your Clarity Project and Getting Your Credentials

Every installation method starts the same way. You need to create a project in Microsoft Clarity and generate a unique Project ID. This ID acts as the API key that links the data from your website to your specific dashboard.

Setting Up the Project

Navigate to https://clarity.microsoft.com/ and click Sign Up. You’ll authenticate using a Microsoft, Google, or Facebook account. This becomes your primary admin account for the project.

Once you’re logged in, click New Project to start the configuration.

Give your project a descriptive name. Something like “Main E-commerce Store – Production” works better than “Test” or “Website 1” when you’re managing multiple properties later.

Enter your full domain in the Website URL field. Include the protocol: https://www.example.com, not just example.com.

Select your industry from the dropdown. This isn’t just categorization; Clarity uses this to provide relevant benchmarking data. If you’re running an e-commerce store, select E-commerce. If you’re offering services, choose Consulting or the closest match.

Click Add Project to finalize the creation.

Extracting Your Project ID

After creating the project, Clarity shows you various installation options. Ignore those for now. We need the raw Project ID.

Click the Settings gear icon in the top navigation bar. In the left sidebar, select the Overview tab.

Look for a field labeled Project ID. This is a unique alphanumeric string that looks something like nz5q2w3k.

Copy this ID and save it somewhere secure. You’ll need it for every configuration step that follows. Treat it like a password: it’s the key to your analytics data.

The Professional Method: Installing Through Google Tag Manager

For any serious implementation, Google Tag Manager is the mandatory standard. It provides superior control, allows advanced triggering options (like firing tags only on specific subdomains), and integrates seamlessly with consent management systems.

Why the Official Template Matters

Here’s something critical that older guides get wrong: they tell you to use a “Custom HTML” tag and paste the raw JavaScript snippet. This method is now deprecated and creates unnecessary risks.

Instead, we’re using the “Microsoft Clarity – Official” tag template from the GTM Community Template Gallery. This template is maintained by Microsoft, which means it stays updated automatically, ensures security compliance, and reduces the risk of JavaScript conflicts with other scripts on your site.

Step-by-Step GTM Configuration

Log in to your Google Tag Manager account and select the container associated with your website.

From the Workspace overview, click Add a new tag. You can also navigate to Tags in the left sidebar and click the New button.

Click the title area at the top (it says “Untitled Tag” by default) and give it a clear name. Use something like Microsoft Clarity - Official or Analytics - Clarity. Consistent naming conventions become crucial when you’re managing dozens of tags.

Adding the Official Template

Click the Tag Configuration box. A side panel titled “Choose tag type” appears.

Look at the top of the list for a blue banner that says “Discover more tag types in the Community Template Gallery.” Click this banner.

In the gallery search bar, type Microsoft Clarity. Select the template titled “Microsoft Clarity – Official” authored by Microsoft.

Important: Verify the author is actually Microsoft. There might be third-party variants in the gallery. You want the official one.

Click Add to workspace and confirm permissions by clicking Add.

Configuring the Tag Parameters

The template opens with a field for your Clarity Project ID. Paste the alphanumeric ID you copied earlier.

You might see advanced options for Cookies or Tour. For a standard base installation, leave these at their default settings. We’ll address consent management and cookie control in the privacy section later.

Setting Up the Trigger

Click the Triggering box below the Tag Configuration.

Select the All Pages trigger.

This is non-negotiable for one critical reason: Clarity captures the entire user journey. If you restrict it to specific pages (like only the checkout), you break the continuity of session recordings. You won’t be able to see how users arrived at that point or what they did before.

Validating Before You Publish

Click the blue Save button. Before publishing this to your live site, you need to validate that it works.

Click Preview in the GTM workspace. This launches the Tag Assistant, a debugging tool built into GTM.

Enter your website URL and click Connect. Your website opens in a new tab with the debug panel attached.

In the Tag Assistant debug window, verify that the Microsoft Clarity - Official tag has fired on the Container Loaded event. You should see it listed with a green checkmark or “Tags Fired” status.

If the tag fired successfully, return to GTM and click Submit. Enter a version description (something like “Initial Clarity Deployment – November 2025”) and click Publish.

Your Clarity tracking is now live.

Platform-Specific Installation Methods

Not everyone uses Google Tag Manager. If you’re running your site on Shopify, WordPress, Wix, or another platform, you have simpler installation options through official apps and plugins.

Shopify: Use the Official App

Shopify has an official Microsoft Clarity app that handles the installation for you. This is the recommended method for Shopify stores.

In older tutorials, you’ll see instructions to edit the theme.liquid file directly. Avoid this method. It’s fragile, breaks during theme updates, and critically, it fails to track events within the secure Checkout area on non-Plus plans.

Instead, search for “Microsoft Clarity: AI Insights” in the Shopify App Store, install it, and follow the setup wizard to connect your Clarity project. The app uses Shopify‘s Web Pixels API, which means it can capture checkout events that manual installations miss.

WordPress: Use the Official Plugin

WordPress has an official Microsoft Clarity plugin. Navigate to Plugins > Add New in your WordPress dashboard, search for Microsoft Clarity, and install the plugin authored by Microsoft.

After activation, follow the setup wizard to authenticate and connect your Project ID.

Important: If your website uses caching plugins (like WP Rocket, W3 Total Cache, or WP Super Cache), clear the cache immediately after installing Clarity. Otherwise, visitors will see cached pages without the tracking script.

Wix: Use the Native Integration

Wix includes built-in support for Microsoft Clarity. Navigate to Settings > Marketing Integrations (often grouped under Analytics), click + New Tool, select Microsoft Clarity, and enter your Project ID.

After saving, publish your site for the changes to take effect globally.

Other Platforms

For platforms like Squarespace, Webflow, or custom HTML sites, you’ll need to use manual code installation. This involves copying the tracking code from your Clarity dashboard and pasting it into your site’s header section. The exact process varies by platform and typically requires some technical knowledge.

Verifying Your Installation Actually Works

Installing the code doesn’t guarantee data collection. You need a rigorous verification process to confirm the telemetry pipeline is active and accurate.

Understanding Data Latency

New users often panic when they see an empty dashboard immediately after installation. Understanding data latency prevents this anxiety.

Clarity provides a Live Users count that updates in near real-time with a latency of just a few seconds. If you visit your website after installation, this count should increment.

However, full session recordings, heatmaps, and aggregate metrics require a processing window of 30 minutes to 2 hours. The system needs time to reconstruct sessions, process the data, and generate visualizations.

If your dashboard remains empty for the first hour, use the technical verification steps below rather than reinstalling the code. Reinstalling won’t help and often creates duplicate data issues.

The Network Audit: Definitive Technical Verification

The most reliable verification method bypasses the dashboard entirely and inspects your browser’s network activity.

Open your website in a Private or Incognito window. This eliminates interference from admin cookies or cached versions of your site.

Access the browser developer tools by right-clicking anywhere on the page and selecting Inspect, or by pressing F12.

Select the Network tab in the developer tools panel.

In the filter search bar at the top, type clarity. This filters the network requests to show only Clarity-related traffic.

Refresh the page.

Look for a request to clarity.ms or a file named collect. Click on this request to inspect it.

Check the Status Code. It should show 200 (OK) or 204 (No Content). Either status confirms successful data transmission.

Click on the Payload or Response tab to see the actual data being sent. It’s usually encoded, but you should see a payload of data rather than an error message.

If this request exists and returns a successful status code, your browser is successfully sending data to Microsoft servers. Your installation is working correctly, and you just need to wait for the processing window.

Simply installing a tracking script isn’t sufficient in the modern regulatory environment. Your implementation must respect user privacy and comply with regulations like GDPR (General Data Protection Regulation) and CCPA (California Consumer Privacy Act).

Microsoft Clarity supports Consent Mode V2, a protocol that ensures Clarity respects user consent preferences. When properly configured, Clarity won’t write cookies or record storage-dependent data until it receives an explicit signal that the user has consented to analytics tracking.

For traffic originating from the EEA (European Economic Area), UK, and Switzerland, implementing consent management is effectively mandatory. Operating without it exposes you to regulatory penalties.

The Basic Setup

To enable consent management in Clarity, navigate to Settings > Setup in your Clarity dashboard. Scroll to Advanced Settings and locate the Cookies toggle. Switch this to OFF.

With this setting disabled, Clarity loads but acts passively until it receives explicit authorization from your consent management platform.

The second part involves configuring your Consent Management Platform (like Cookiebot, OneTrust, or CookieYes) to communicate with Clarity when users accept analytics cookies. This technical implementation varies depending on your consent platform and website setup.

The Practical Impact on Your Data

When consent management is properly configured, you’ll see two types of sessions in your dashboard:

Sessions from users who accepted cookies show complete user journeys, including return visits and cross-session behavior.

Sessions from users who declined cookies show individual sessions without the ability to connect them to previous visits.

This is the correct behavior. You’re respecting user privacy while still collecting valuable behavioral data.

Troubleshooting: When Things Don’t Work as Expected

Even with perfect theoretical setup, real-world environments present edge cases. Here are the most common issues and how to resolve them.

Heatmaps Appear Broken (Text Only, No Styling)

If your heatmaps show text elements but lack all visual styling, Clarity can’t access your site’s CSS files. This usually happens when your site is behind a strict firewall or when the CSS is hosted on a CDN that blocks bots.

The Clarity rendering bot needs access to your stylesheets to reconstruct your site visually. Without this access, it can only show the DOM structure without visual formatting.

The fix: whitelist Clarity IP addresses in your firewall or CDN settings. Check the Clarity documentation for the current IP ranges that need whitelisting.

Dashboard Shows Zero Sessions After 24 Hours

If more than 24 hours have passed and your dashboard remains completely empty, you likely have a caching issue.

The most common scenario: you saved your GTM workspace but didn’t publish it. The changes exist in your workspace preview but aren’t live on your actual site.

Another common scenario: your website is serving a cached version of the page without the tracking tag. This happens frequently with Cloudflare, WP Rocket, or server-side caching.

The fix: first, verify that your GTM workspace was actually published. Then, purge all caches: your GTM workspace cache, your CDN cache (Cloudflare, etc.), and any server-side or plugin caches (WP Rocket, W3 Total Cache).

You’re Seeing Duplicate Sessions or Double Counting

If session counts seem abnormally high or you’re seeing duplicate recordings of the same session, you’ve installed Clarity twice.

This typically happens when someone installs both the GTM tag and a platform-specific app (like the Shopify app) simultaneously. Both installation methods are working, which means Clarity is receiving data twice for every visitor.

The fix: remove one installation method. If you want maximum control and advanced triggering, keep the GTM method and uninstall the app. If you prefer simplicity and want the platform-specific features (like the Shopify checkout integration), keep the app and remove the GTM tag.

Checkout Pages Aren’t Being Recorded

If your checkout pages show no session recordings, this is often related to how your platform handles secure checkout environments. Different platforms have different security restrictions that can prevent tracking code from executing on checkout pages.

For Shopify users on Basic plans, this is typically because manual code insertions (like editing theme.liquid) don’t execute on the secure checkout. Using the official Shopify app solves this issue.

For other platforms, the solution depends on your specific setup and how your checkout is configured.

Sessions Are Recording But Specific Elements Are Missing

If sessions are recording but specific elements (like modals, dropdowns, or dynamically loaded content) aren’t appearing in the playback, those elements are likely being loaded after the initial DOM scan.

Clarity captures DOM changes, but if content is loaded in a way that bypasses standard DOM mutation events (like certain Shadow DOM implementations or iframe content), it might not be captured.

The fix: this is more complex and often requires adjusting how your site loads these elements. In some cases, you may need to work with your developer to ensure dynamic content triggers proper DOM mutation events.

Next Steps: Moving from Installation to Insight

You’ve now established a robust, privacy-compliant behavioral analytics infrastructure. The technical foundation is in place. Here’s how to start extracting value from the data.

If You’re Just Getting Started with Behavioral Analytics

Wait 24-48 hours for meaningful data to accumulate. You need at least a few hundred sessions to identify patterns.

Start with the Rage Clicks metric. Navigate to the Recordings section and filter by Rage Clicks. These are sessions where users clicked the same element repeatedly in frustration.

This is the highest-value signal for immediate UX improvements. If 50 users rage-clicked your “Submit” button, that button is broken or appears broken. Fix it first.

Review your most-viewed pages. Go to Dashboard > Pages and sort by sessions. Watch recordings from your top three pages to understand how people actually use them.

If You’re Already Analyzing User Behavior

Integrate Clarity with Google Analytics 4. Navigate to Settings > Integrations in Clarity and connect your GA4 property.

This integration allows you to view session recordings directly within the GA4 interface. When you’re analyzing a conversion funnel in GA4 and see a drop-off, you can immediately watch recordings of users who dropped off at that step.

Set up Custom Tags for specific user segments. You can tag sessions based on traffic source, user type, or custom events. This allows you to filter recordings by segment (like “users from Facebook ads” or “mobile users on checkout”).

If You’re Ready for Advanced Implementation

Configure IP blocking to exclude internal traffic. Navigate to Settings > IP Blocking and add your office or home IP addresses. This prevents your team’s testing sessions from skewing your heatmaps.

Set up Custom Events to track specific interactions. While Clarity automatically tracks clicks and scrolls, you can track custom events like “Video Played” or “PDF Downloaded” for deeper analysis.

Create segment comparisons using filters. Compare mobile vs desktop behavior, or new vs returning users, to identify device-specific or experience-specific issues.

Conclusion: The Visual Evidence You’ve Been Missing

Traditional analytics tells you the numbers. Microsoft Clarity shows you the reality behind those numbers. You now have the technical infrastructure to see exactly where users get confused, where they encounter friction, and where opportunities for improvement exist.

The installation might seem complex, but you’ve built something far more valuable than just another analytics implementation. You’ve created a complete behavioral intelligence system that respects user privacy while capturing the nuanced evidence needed to make informed optimization decisions.

Every conversion rate improvement starts with understanding why users behave the way they do. You now have that visibility.

Leave a Comment

Your email address will not be published. Required fields are marked *