---
title: "How to Implement Webeyez with OneTrust"
url: "https://help.webeyez.com/en/article/how-to-implement-webeyez-with-onetrust"
language: "en"
last_updated: "2026-06-11T20:51:56.503Z"
---

# How to Implement Webeyez with OneTrust

In an era where data privacy regulations like GDPR, CCPA, and CPRA govern the digital landscape, website owners face a delicate balancing act. You need robust user behavior analytics and anomaly detection to keep your site optimized, but you must respect user consent choices.

If you use **Webeyez** to monitor user experience and technical anomalies alongside **OneTrust** as your Consent Management Platform (CMP), proper integration is critical. To stay compliant, Webeyez should only execute *after* a visitor has granted consent typically under the **Analytics** or **Performance** cookie category.

Here are the three best options for implementing Webeyez with OneTrust, depending on your architecture.

## Option 1: Deploy Webeyez Directly Through OneTrust (The Easiest Route)

If you prefer a centralized approach where your CMP directly handles script injection, you can let OneTrust act as the gatekeeper and the loader.

### How to set it up:

1.  Log into your **OneTrust Admin Portal**.
2.  Identify or create the appropriate consent category for Webeyez. Most organizations place it under **Performance Cookies** or **Analytics Cookies**.
3.  Navigate to your cookie script settings and add the Webeyez JavaScript tracking snippet as a **Custom Script**.
4.  Explicitly assign this script to your chosen Analytics/Performance category.
5.  **Publish** your updated OneTrust configuration.

**How it works:** OneTrust blocks the script by default. The moment a visitor interacts with your cookie banner and accepts that specific category, OneTrust automatically injects and fires the Webeyez tag in real time.

## Option 2: Trigger Webeyez via OneTrust Events (For Hardcoded Implementations)

If you have a hardcoded site structure or prefer to control script loading via native JavaScript, you can leverage OneTrust's built-in `OptanonWrapper()` function. This method ensures Webeyez loads dynamically based on active consent groups.

### The Implementation Code:

You can add the following logic to your site's codebase. It listens for OneTrust to initialize and checks if the user has opted into the required category before fetching the Webeyez script:

```js
function OptanonWrapper() {
    // Check if the user accepted the Performance/Analytics category
    // Note: 'C0002' is a standard example. Always verify your specific OneTrust category ID.
    if (OnetrustActiveGroups.includes('C0002')) {
        loadWebeyez();
    }
}

function loadWebeyez() {
    // Prevent duplicate script injection if already loaded
    if (document.querySelector('script[src*="webeyez.com"]')) return;

    var s = document.createElement('script');
    s.src = 'https://YOUR-WEBEYEZ-TAG.js'; // Replace with your actual Webeyez script URL
    s.async = true;
    document.head.appendChild(s);
}
```

⚠️ **Important Note:** OneTrust category IDs can vary based on your tenant setup. While `C0002` is frequently used for Performance cookies, double-check your OneTrust Cookie Consent dashboard to confirm your exact ID.

## Option 3: Condition Firing Through Google Tag Manager (The Marketer's Choice)

If your team relies heavily on Google Tag Manager (GTM) to manage marketing and analytics tools, you can use OneTrust’s native GTM integration to gate Webeyez.

### How to set it up:

1.  Ensure the **OneTrust CMP** script is correctly deployed on your website.
2.  In GTM, build or open your existing **Webeyez Custom HTML or standard script tag**.
3.  Instead of setting the tag trigger to *All Pages*, use OneTrust's data layer events.
4.  Configure a custom event trigger (typically `OneTrustGroupsUpdated`) that checks if the `OnetrustActiveGroups` variable contains your specific category ID (e.g., `,C0002,`).

This setup keeps your tag management streamlined inside GTM while strictly respecting the consent tokens passed from OneTrust.
