Microsoft Clarity

Send your event data from RudderStack to Microsoft Clarity.

Microsoft Clarity is a heatmap and session recording tool that helps you better understand how users are interacting with your website.

RudderStack supports Microsoft Clarity as a web device mode destination to which you can seamlessly send your event data.

Connection compatibility

Destination Information
  • Status: Generally Available
  • Supported sources: Web
  • Refer to it as MICROSOFT_CLARITY in the Integrations object.
Connection Modes
SourceCloud modeDevice modeHybrid mode
Webnot supportedsupportednot supported
Supported Message Types
SourceIdentifyPageTrackScreenGroupAliasRecord
Device mode
Websupportednot supportedsupportednot supportednot supportednot supportednot supported

Setup

  1. In your RudderStack dashboard, set up a source.
  2. Go to the Overview tab of your source and select Add Destination > Create new destination.
Add new destination in RudderStack dashboard
  1. Select Microsoft Clarity from the list of destinations. Then, click Continue.

Connection settings

SettingDescription
Project IDEnter your Microsoft Clarity project ID.
Microsoft Clarity Cookie ConsentTurn on this toggle to allow RudderStack to call the Microsoft Clarity API to track the users using a cookie.

info
If the Cookies setting is enabled in the Clarity project settings, then you need not enable the Microsoft Clarity Cookie Consent dashboard setting.
Client-side Events FilteringThis setting lets you specify which events should be blocked or allowed to flow through to Microsoft Clarity.

See Client-side Events Filtering for more information on this setting.
Use device mode to send eventsThis setting is toggled on by default as this is a web device mode-only destination
Consent management settingsConfigure the consent management settings for the specified source by choosing the Consent management provider from the dropdown and entering the relevant consent category IDs.

See Consent Management in RudderStack for more information on this feature.

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

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

Track

You can use the track events to send custom events to Microsoft Clarity. RudderStack maps these events to Clarity’s custom events to help you track specific user actions on your website.

A sample track call is shown below:

rudderanalytics.track("Product Added", {
  productId: "123",
  category: "Shoes"
});

RudderStack maps the track event to Microsoft Clarity’s API by sending the event name to Clarity. The implementation uses the following mapping:

window.clarity("event", "Product Added");
warning
Microsoft Clarity’s custom events accept only the event name. Event properties are not supported and will be ignored.

Automatic mappings

Microsoft Clarity automatically classifies your track events to the following Smart Events, based on your pre-configured mappings specified in the Microsoft Clarity dashboard:

  • Purchase
  • Add to Cart
  • Begin Checkout
  • Contact Us
  • Submit Form
  • Request Quote
  • Sign Up
  • Login
  • Download

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:
Microsoft Clarity project ID

Questions? Contact us by email or on Slack