🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Set up MS Clarity in Magento 2?

By Sanjay JethvaUpdated on May 30, 2025 4 min read

In this blog, learn how to set up MS Clarity in Magento 2 to analyze your shopper’s interaction with your store.

What is Microsoft Clarity and Why Use it?

Microsoft Clarity is a free heatmaps & session recording tool which helps you understand your user’s behaviour on your site.

You can easily analyze sections where they spent most of the time and also the least to make necessary changes to attract engagement. 

Microsoft Clarity Heatmap Dashboard

Microsoft clarity heatmap dashboard 

Adding MS Clarity to Magento 2, you can

  • Get usages statistics
  • Multiple options to filter out shoppers’ behaviour
  • And more 

Steps to Add Microsoft Clarity Code to Magento 2 (Manually)

This is one of the easiest ways to add Microsoft Clarity code to Magento 2 without needing any external tools or third-party apps. 

Follow these manual steps to add MS Clarity to Magento 2. 

Step 1: Create a Microsoft Clarity Account

Head to Microsoft Clarity and create your free account. 

Create a Microsoft Clarity Account

Step 2: Get the Microsoft Clarity Tracking Code  

Navigate to Setup > Advanced setting. Then head to Install manually and click on Get tracking code. 

Get the Microsoft Clarity Tracking Code

Now, copy the code and head to your Magento 2 admin panel. 

Copy the Code from MS Clarity

Step 3: Add the Tracking Code in Magento 2 

Head to Content > Configuration and edit your main website store. Then, scroll down to the “Other Settings” section and open the “HTML Head” settings.

Go to Magento Admin and Head to HTML Head

Now, find the “Scripts and Style Sheets” and paste the code you copied from Microsoft Clarity. 

Find Scripts and Style Sheets and Paste the Code

Now, browse through your store and then view the data in Clarity to verify if the setup is working properly. 

Other Resources 

Like Microsoft Clarity, here are some more tracking setup guides for exceptional data collection:

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.