Cookie Consent

Cookie Consent Groups and Effects

Effects on Third Party Services

The consent groups are extracted from the OptanonConsent cookie, which contains statuses in the following format:

{ groups = C0004:0,C0001:1,C0002:0,C0003:0 }

Each cookie group (e.g. C0001, C0002) has a meaning and a value:

  • Status = 1 indicates consent is granted.
  • Status = 0 indicates consent is denied.
Group IDCategoryDescription
C0001Strictly NecessaryAlways enabled
C0002Analytical / TrackingActivity tracking and site performance analysis
C0003FunctionalFeatures like product videos, order placement
C0004TargetingAdvertising and recommendations
C0005Social MediaSocial media ads (e.g. Facebook, YouTube)

Cookie Toggles

NameConsent Category
Algolia EventsAnalytical (C0002)
Algolia Analytic TagsAnalytical (C0002)
Datadog RUMAnalytical (C0002)
Exponea TrackingAnalytical (C0002)
Noibu TrackingAnalytical (C0002)
Bazaarvoice Pixel TrackingAnalytical (C0002)
Builder.IO Page TrackingAnalytical (C0002)
Videoly videosFunctional (C0003)

An enum is created to represent each consent group by name instead of group ID.

// assets/constants/cookie-consent.ts
export enum OneTrustCookieGroup {
  StrictlyNecessary = "C0001",
  Analytical = "C0002",
  Functional = "C0003",
  Targeting = "C0004",
  SocialMedia = "C0005",
}

Globally checkConsent method is implemented in the rootStore that checks if a consent group is granted or denied.

This method scans the OptanonConsent cookie to determine user's preferences.

// stores/root.store.ts
const consentCookie = useCookie("OptanonConsent");

/**
 * @param {OneTrustCookieGroup} cookieGroupId - Example: "C0001"
 */
function checkConsent(cookieGroupId: OneTrustCookieGroup) {
  if (!consentCookie.value) return false;
  const decodedData = extractConsentGroups(consentCookie.value); // Contains `acceptedGroups` list e.g. ["C0001", "C0002", "C0004"]
  if (!decodedData) return false;
  return decodedData.acceptedGroups.includes(cookieGroupId);
}

Example Usages

  • Third Party Scripts: Nuxt Scripts supports manual script loading based on a custom trigger which is leveraged to toggle state of a global consent variable for specific third party script
// utils/exponeaUtils.ts
export const exponeaTrackingConsent = useScriptTriggerConsent();

// app.vue
useExponeaScript(exponeaScriptCDNSource, {
  trigger: exponeaTrackingConsent,
});

exponeaTrackingConsent.accept() is called when user accepts tracking cookie. Refer technical strategy and demo here.

  • Builder CMS Activity Tracking: track requests from browser are not triggered if user has denied consent to tracking.
<!-- TsContent.vue -->
<template>
  <content
    :model="props.model"
    :content
    :api-key
    :customComponents
    :can-track="rootStore.checkConsent(OneTrustCookieGroup.Analytical)"
  />
</template>

References


Copyright © 2026