Microsoft Clarity is a heatmaps and session recording tool. It helps you better understand how users are interacting with your website through session replays and heatmaps.

Getting started

RudderStack supports sending event data to Microsoft Clarity via the following connection modes:

Connection ModeWebMobileServer
Device modeSupported--
Cloud mode---

Once you have confirmed that the source platform supports sending events to Microsoft Clarity, follow these steps:

  1. From your RudderStack dashboard, add a source. Then, from the list of destinations, select Microsoft Clarity.
  2. Assign a name to the destination and click Continue.

Connection settings

To successfully configure Microsoft Clarity as a destination, you will need to configure the following settings:

  • Project ID: Enter your Microsoft Clarity project ID. For more information on obtaining your Clarity project ID, refer to the FAQ section below.
  • Microsoft Clarity Cookie Consent: Enable this setting to allow RudderStack to call the Microsoft Clarity API to track the users using a cookie.
  • Client-side Events Filtering: This setting lets you specify which events should be blocked or allowed to flow through to Microsoft Clarity. For more information on this setting, refer to the Client-side Events Filtering guide.
  • Use device mode to send events: As this is a web device mode-only destination, this setting is enabled by default and cannot be disabled.
  • OneTrust Cookie Categories: This setting lets you associate OneTrust cookie consent groups to Microsoft Clarity.

Identify

You can use the identify events to create a new user in Microsoft Clarity.

A sample identify call is shown below:

rudderanalytics.identify("1hKOmRA4GRlm", {
name: "Alex Keener",
email: "alex@example.com"
});

By default, Clarity uses cookies to track your users and gather the session data. You can configure your Clarity project to require cookie consent, that is, Clarity will not place a cookie until a user provides consent.

Microsoft Clarity cookie consent enabled

In this case, to track the user sessions via the cookie, make sure you enable the Microsoft Clarity Cookie Consent setting in the RudderStack dashboard. This setting indicates that RudderStack can call the Clarity API to track the users via a cookie once a user provides consent.

If the Cookies setting is enabled in the Clarity project settings, then you need not enable the Microsoft Clarity Cookie Consent dashboard setting.

Supported mappings

RudderStack maps the following identify attributes to the corresponding Microsoft Clarity properties:

RudderStack propertyMicrosoft Clarity property
userId
Required
customuserid
context.sessionIdcustomsessionid
context.traits.customPageIdcustompageid

FAQ

Where can I find the Microsoft Clarity project ID?

To get your Microsoft Clarity project ID, follow these steps:

  1. Log into your Microsoft Clarity dashboard.
  2. Select your Microsoft Clarity project and go to Settings > Overview to get your project ID, as shown:
Microsoft Clarity project ID

Contact us

For more information on the topics covered on this page, email us or start a conversation in our Slack community.

On this page