Skip to content

Using a Consent Management Platform with Tracify

This guide explains how to connect a consent management platform (CMP) to Tracify. It applies whether you installed the client-side JavaScript snippet manually or use a platform plugin such as Shopware 6 or WooCommerce.

Your CMP needs to tell Tracify when the visitor has accepted, declined, or revoked tracking consent. For the underlying API, see Consent management.

Tracify is consent-aware: the tracking script is always loaded on the page, before consent is given, and automatically adjusts what it collects based on the visitor's consent status.

  • Without consent, Tracify collects limited data using privacy-safe methods.
  • With consent, Tracify enables richer attribution capabilities such as cookies and local storage, client-side fingerprinting, and the click IDs and user data needed for conversion postback.

Choose your setup


Manual client-side JavaScript install

Install the Tracify smart snippet as described in Client-side JavaScript library, then use the CMP examples below to call tracify.setConsent() from your CMP.

Shopware 6 and WooCommerce plugins

The plugin installs the Tracify smart snippet for you. Do not paste the snippet again, and do not block the plugin-injected snippet with your CMP. Add only the CMP consent wiring from the examples below.

This plugin CMP integration guidance applies to:

  • Shopware 6 plugin version 1.2.11 and later
  • WooCommerce plugin version 3.1.9 and later

Shopware 6 and WooCommerce do not provide a single built-in consent API that Tracify can read automatically across all CMPs, so the consent call must come from your CMP plugin or custom storefront script.

Shopify

In the standard Shopify setup, Tracify reads consent from Shopify's Customer Privacy API automatically. Manual CMP wiring is usually not required unless you use a custom setup that does not rely on Shopify's built-in consent handling.


The Tracify smart snippet creates window.tracify immediately and loads the SDK asynchronously. Calls such as tracify.setConsent(true) are queued safely even if the SDK has not finished loading yet. Use this method from your CMP callback:

tracify.setConsent(hasConsent, consentId);
Parameter Type Required Description
hasConsent boolean Yes true when the visitor has consented to tracking, false when consent is declined or revoked.
consentId string No Optional consent record ID from your CMP.

Tip

setConsent() emits a consent event with the full tracking information Tracify needs. You do not need to re-send page views or other events after consent is granted.

Event-based CMP callbacks


Most CMPs provide a JavaScript callback or browser event when consent status changes. Listen for that callback and call tracify.setConsent() with the visitor's current tracking consent status.

The dedicated sections below cover Cookiebot, Usercentrics, OneTrust, and Klaro. For any other CMP that exposes JavaScript events, adapt the generic pattern below to your CMP's callback mechanism.

<script>
  // Replace this with your CMP's actual callback mechanism.
  yourCMP.onConsentChange(function (consentStatus) {
    tracify.setConsent(consentStatus === "accepted");
  });
</script>

Cookiebot


Use Cookiebot's JavaScript events and map the relevant consent category to Tracify. Most stores use statistics or marketing; choose the category that matches how Tracify is classified in your Cookiebot setup.

<script>
  window.addEventListener("CookiebotOnAccept", function () {
    // Check only the category Tracify is classified under in your Cookiebot
    var hasConsent = Cookiebot.consent.statistics;

    tracify.setConsent(hasConsent);
  });

  window.addEventListener("CookiebotOnDecline", function () {
    tracify.setConsent(false);
  });
</script>

If Cookiebot can expose a consent ID in your setup, pass it as the second argument:

tracify.setConsent(true, "consent-record-id");

Usercentrics


Listen for Usercentrics consent changes and check the service name you configured for Tracify.

Prerequisite: enable the ucEvent window event

Usercentrics does not emit ucEvent by default. You must first create it in the Usercentrics Admin Interface under Implementation → Data Layer & Events by adding a window event named ucEvent. Until it is configured, the listener below never fires and consent is never sent to Tracify. See Usercentrics' guide on communicating consent information to third-party applications.

<script>
  window.addEventListener("ucEvent", function (event) {
    if (!event.detail || event.detail.event !== "consent_status") {
      return;
    }

    var hasConsent = event.detail["Tracify"] === true;
    tracify.setConsent(hasConsent);
  });
</script>

Replace "Tracify" with the exact service name used in your Usercentrics configuration, for example "Tracify tracking" or "Analytics".

OneTrust


Use OneTrust's consent-change callback and check the active group that contains Tracify. The example below uses C0004, which is commonly used for targeting/marketing cookies, but your setup may use a different group.

<script>
  OneTrust.OnConsentChanged(function () {
    var activeGroups = window.OnetrustActiveGroups || "";
    var hasConsent = activeGroups.indexOf("C0004") !== -1;

    tracify.setConsent(hasConsent);
  });
</script>

Replace C0004 with the group ID that contains Tracify in your OneTrust setup.

Klaro


If you use Klaro, subscribe to consent manager changes and read the service name configured for Tracify.

<script>
  klaro.getManager().watch({
    update: function (manager) {
      var hasConsent = manager.getConsent("tracify") === true;
      tracify.setConsent(hasConsent);
    },
  });
</script>

Replace "tracify" with the Klaro service key used in your configuration.

Declarative CMP scripts


Some CMPs activate scripts only after consent by changing a script from a non-executable type, such as text/plain, to an executable script.

If your CMP fires JavaScript events instead of gating scripts this way, use the event-based examples above (for example, Cookiebot).

If you installed the Tracify snippet manually, the smart snippet should still load normally. Configure only the small consent activation script below as consent-gated.

If you use the Shopware 6 or WooCommerce plugin, keep the plugin-installed Tracify snippet unblocked and add only the small consent activation script below through your CMP.

<script type="text/plain" data-cookieconsent="statistics">
  tracify.setConsent(true);
</script>
<script type="text/plain" data-category="statistics">
  tracify.setConsent(true);
</script>
<script type="text/plain" data-consent="analytics">
  tracify.setConsent(true);
</script>

Use the CMP category that matches your consent banner configuration. If Tracify is classified under marketing rather than statistics or analytics, use the marketing category instead.

Verify the setup


After adding the CMP integration:

  1. Open the storefront in a private browser window.
  2. Decline tracking consent and confirm the page still loads normally.
  3. Accept tracking consent and confirm your CMP script calls tracify.setConsent(true).
  4. Revoke consent, if your CMP supports it, and confirm it calls tracify.setConsent(false).
  5. Check the browser Network tab for Tracify requests returning 200 OK.

If consent is never passed to Tracify, consent-gated features such as cookies, client-side fingerprinting, click IDs, and conversion postback identifiers will remain disabled.