If your site uses a cookie banner (OneTrust, Cookiebot, Usercentrics, etc.), there are two ways to run Mida alongside it. Both give you the same data in your reports. The only difference is what your visitors see while the banner is open.
Check with your legal team which one fits your privacy policy. If you don't use a cookie banner, just follow the standard installation guide.
Method 1: Load Mida after consent | Method 2: Consent Mode | |
Does Mida run before Accept? | No | Yes, it shows the variant only |
When the variant shows | After Accept | Right away |
Who shows up in reports | Only visitors who accept | Only visitors who accept |
Setup | Block Mida in your consent manager | Add |
Best for | The strictest legal reading | A smooth visitor experience |
Method 1: Load Mida only after consent (safest for compliance)
Your consent manager blocks the Mida script until the visitor clicks Accept. No Mida code runs before that.
How to set it up: in your consent manager, put the Mida script in your Analytics or Performance category. If you use GTM, fire the Mida tag on your consent trigger instead.
The variant shows after Accept. This is often the only option when your legal team requires Mida to load after consent. For example, you're testing a new headline:
A visitor lands and sees your original headline, "Free shipping on all orders".
3 seconds later they click Accept.
Mida loads and swaps the headline to "Get 20% off today".
So the visitor may see the page change once. Since your consent manager loads before Mida, this can happen on later pages too. Visitors who don't accept only see the original.
Method 2: Consent Mode (best for visitor experience)
Mida loads first and shows the variant right away, so there's no flicker. It doesn't count the visitor until they accept.
How it works:
Before Accept: the visitor sees their variant, but Mida doesn't add them to your test results. The variant is only kept for the current browser session (session storage and a cookie that expires after 1 minute), so the page stays the same as they click around.
On Accept: Mida records the visitor and their variant from that moment, and remembers the variant for future visits.
On Decline: Mida clears its data from the browser, and the visitor never appears in your reports.
Step 1: Add &cookie=1 to your Mida script, and place it as high as possible in the <head>, before your consent manager:
<script async src="https://cdn.mida.so/js/optimize.js?key=PROJECT_KEY&cookie=1"></script>
(EU accounts use cdn-eu.mida.so.)
Step 2: Run this from your consent manager or GTM when the visitor makes a choice:
// Visitor accepted
mida.grantConsent(true)
// Visitor declined
mida.grantConsent(false)
Will I lose data either way?
Yes, and the amount is the same with both methods. Mida only counts visitors who accept, so data only shows up in your report once a visitor clicks Accept.
For example, say 1,000 visitors come in and 600 accept. Both methods report about 600 visitors. Conversions that happen before a visitor accepts aren't counted by either method.
The one difference favours Method 2. A visitor who accepts on their third page saw the same variant the whole time. With Method 1, they saw the original on pages 1 and 2 and then switched to the variant.

