> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.hoppyapps.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 🔗 Integrate Hoppy Cookie with Microsoft Clarity

Microsoft Clarity records session replays and heatmaps of how visitors use your store. Because it can collect visitor behavior, it should only run after a visitor gives permission.

The **Microsoft Clarity** integration in **GDPR EU Cookie Banner** loads the Clarity script only after consent is given and keeps Clarity informed of every consent choice the visitor makes.

---

# **⚠️ Before You Begin**

Make sure:

* **GDPR EU Cookie Banner** is installed, the App Embed is enabled, and your banner is published  
* You have a Microsoft Clarity project and know its **project ID**

⚠️ **Important:** This integration works only if Clarity is set up through the banner. If Clarity is already installed through a theme, another app, or a custom script, remove it first. Otherwise Clarity can load before consent or run twice.

---

# **🔑 Step 1 — Find Your Clarity Project ID**

➡️ Sign in to Microsoft Clarity

➡️ Open your project's **Settings**

➡️ Copy the **project ID** (a short code made of letters and numbers, for example `abc123def456`)

⚠️ Copy only the ID. Do not paste a full script, a URL, or extra spaces.

---

# **🛠️ Step 2 — Open the Integration**

➡️ Open **GDPR EU Cookie Banner**

➡️ Click **Integrations** in the left menu

➡️ Open the **Microsoft Clarity** card

---

# **⚙️ Step 3 — Enter the ID and Enable**

➡️ Paste your ID into **Microsoft Clarity ID**  
(help text: *Enter your Microsoft Clarity project ID*)

➡️ Click **Enable** so the status reads **Microsoft Clarity is currently Enabled**

➡️ Click **Save** in the save bar

The integration only runs when it is enabled **and** an ID is entered.

---

# **🔄 How It Works**

### **When a visitor accepts**

If the visitor accepts **Marketing** or **Analytics** cookies:

* The Clarity script is loaded  
* Clarity is told which types of storage are allowed

### **Consent signals sent to Clarity**

* **Ad storage** is **granted** when the visitor accepts Marketing, otherwise **denied**  
* **Analytics storage** is **granted** when the visitor accepts Analytics, otherwise **denied**

The signal is updated every time the visitor changes their choices.

### **When a visitor declines both**

The Clarity script is not loaded, and the consent signal is sent as denied.

⚠️ With the **Decline only** banner type, all cookies are allowed by default, so Clarity loads before the visitor makes a choice. If the visitor then declines, Clarity is sent a denied signal.

---

# **🧪 Step 4 — Test the Integration**

You can also open **View guide** under **Step 2: Test if integration with Microsoft Clarity works successfully** inside the integration page.

### **Test with Accept**

➡️ Open your storefront in an Incognito or Private window

➡️ Open the browser console (press **F12**)

➡️ Click the accept button in the banner (default text: **Accept**)

➡️ Type `window.hoppyClarityLoaded` and press **Enter**

**Expected result:** `true`

### **Test with Decline**

➡️ Open a fresh Incognito or Private window

➡️ Decline marketing and analytics cookies

➡️ Type `window.hoppyClarityLoaded` in the console

**Expected result:** `undefined` or `false`

You can also check the **Network** tab. A request to `clarity.ms` should appear only after consent is given.

---

# **🛠️ Troubleshooting**

**Clarity loads before consent**

Clarity is installed somewhere else, such as theme code or another app. Remove it from there and let the banner manage it.

**Clarity does not load after accepting**

* Check that the status is **Enabled** and you clicked **Save**  
* Check the ID has no extra spaces or characters  
* Check that the visitor accepted **Marketing** or **Analytics**  
* Check that the visitor is in a region where your banner is shown. Visitors outside your selected regions are not managed by the banner, so the integration does not load Clarity for them

**No recordings appear in Clarity**

Confirm the project ID matches the Clarity project you are checking, and that visitors accepted Marketing or Analytics.

**Clarity ran twice**

Remove any other Clarity installation.

---

# **⚠️ Important Notes**

* Changing consent later updates the signal sent to Clarity  
* The integration does not need theme code changes  
* Keep your privacy policy up to date to mention session recording

---

# **🎉 Final Result**

✅ Clarity loads only after Marketing or Analytics consent

✅ Clarity always receives the visitor's latest consent choices

✅ No theme edits are needed