Skip to main content
This guide walks through how to integrate GrowthBook A/B tests with Microsoft Clarity for getting heatmaps of your experiment pages. This will work with GrowthBook client side SDKs (HTML or Javascript).

Passing Data to Microsoft Clarity

To make the heat maps aware of your A/B tests, you should send the experiment id and variation id to Clarity. This can be done through the “trackingCallback” in the GrowthBook client, by setting a custom tag in Clarity. You can use either one event for both experiment name and variation id, or two separate custom events. eg:
This callback may be different depending on your implementation. Here are some full examples:

Javascript

If you are using a recent version (> 1.4.1) you can use the third party tracking plugin:
If you have an older SDK, you can manually send the data to Clarity in the trackingCallback:

HTML SDK

This example assumes you’re using Google Analytics/GTM. Place this before you load the GrowthBook HTML SDK:
If you are using another tracker, you can replace the gtag and dataLayer calls with the appropriate tracking code.

Using Custom Events in Clarity

You can apply custom filters to the heatmap filters in Clarity to only show data for specific experiments or variations. This can be done by creating a custom event in Clarity and filtering by that event. You can read more about this from the microsoft site.