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
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.

Step 2: Get the Microsoft Clarity Tracking Code
Navigate to Setup > Advanced setting. Then head to Install manually and click on Get tracking code.

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

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.

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

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: