Integrate a custom CMP

Written By Vincent Stoit

Last updated 5 days ago

Most online retailers run one of the well-known consent management platforms (CMPs); Cookiebot, OneTrust, Complianz, and the like. But not every business does. Some teams have built their own in-house consent solution, tailored to their specific legal requirements, design system, or CMS. If that's you, the good news is that Metrion doesn't require you to switch to a third-party CMP just to get accurate, privacy-compliant conversion tracking. You can connect your own custom CMP directly.

Why Metrion needs to know about consent in the first place

Metrion is a first-party conversion tracking platform, which means it processes conversion and visitor data directly on your own domain rather than relying solely on third-party cookies. Even so, what Metrion is allowed to do with that data still depends entirely on the consent choices a visitor makes on your site.

Rather than guessing, or forcing you into a rigid, one-size-fits-all consent flow, Metrion asks your CMP directly: what has this visitor agreed to? That's what makes the integration below possible.

The integration point: update_consent()

If you've built your own CMP, connecting it to Metrion comes down to a single JavaScript call. Whenever a visitor sets or updates their consent preferences, your CMP should call:

window.metrion.consent_manager.update_consent({ 
"allow_marketing": 0,
"allow_pii": 0,
"allow_uid": 0,
"allow_sid": 0 }); 

This tells Metrion exactly what the visitor has consented to, using four flags:

Flag Controls

allow_marketing

Whether marketing-related tracking (e.g. ad platform matching, campaign attribution) is allowed

allow_pii

Whether personally identifiable information may be processed

allow_uid

Whether a persistent user identifier may be set

allow_sid

Whether a session identifier may be set

Each flag takes 1 (consent given) or 0 (consent withheld). You call update_consent() with the visitor's actual choices. So a visitor who accepts everything would trigger the same call with all flags set to 1, while a visitor who rejects everything (as in the example above) sends all zeros. Metrion then adjusts what it tracks and stores in real time, based on exactly those values. Nothing more, nothing less.

Where this call should fire

To keep tracking accurate, the call needs to run at the right moments:

  • On initial consent. As soon as the visitor makes their first choice (accept all, reject all, or a custom selection), call update_consent() with the corresponding flags.

  • On every consent change. If a visitor later reopens your consent settings and changes their preferences, fire the call again with the updated values. Metrion will apply the new consent state going forward.

  • On page load, for returning visitors. If your CMP stores a visitor's previous choice (e.g. in a cookie or local storage), replay that stored choice into update_consent() as soon as your CMP initializes on each new page. This keeps Metrion in sync without asking the visitor to consent again.

Setting Metrion to expect a custom CMP

Because Metrion normally auto-detects supported third-party CMPs, it needs to know when you're managing consent yourself instead. This is a one-time setting:

  1. In your Metrion installation settings, go to the CMP configuration section.

  2. Select Custom CMP as your consent management platform.

  3. Save the setting.

Once this is selected, Metrion stops listening for supported third-party CMP signals and instead relies entirely on the update_consent() calls your own CMP sends. This also means your CMP is now responsible for triggering that call at the right times. Metrion won't fall back to any default behavior on your site once custom mode is active.

What this gives you

Building your own CMP already gives you full control over design, legal wording, and consent flow. Connecting it to Metrion means you don't have to trade that control away to get reliable, first-party conversion tracking. You keep your existing consent infrastructure, and Metrion simply plugs into it. Tracking exactly what your visitors have agreed to, no more.

In short

  1. Select Custom CMP in your installation settings

  2. Update your consent function to:

window.metrion.consent_manager.update_consent({ 
"allow_marketing": 0,
"allow_pii": 0,
"allow_uid": 0,
"allow_sid": 0 }); 

With those in place, your custom CMP and Metrion work together seamlessly. Accurate conversion data, fully aligned with the consent choices your visitors actually make.