# Microsoft Clarity

> Adds the Microsoft Clarity script for heatmaps and session recordings.

- Type: HTML
- Runs: Site-wide header
- Category: [Analytics & Tracking](https://wpide.com/library/category/analytics/)
- Tags: analytics, clarity, heatmaps, microsoft
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/microsoft-clarity/

## Code

```html
<!-- Microsoft Clarity. Replace YOUR_PROJECT_ID with your Clarity project ID. -->
<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>
```

## Notes

YOUR_PROJECT_ID is a placeholder from clarity.microsoft.com > Settings > Setup.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Microsoft Clarity" in its snippet library and add it in one click; or create a new HTML snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
