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:
- Log into your OneTrust Admin Portal.
- Identify or create the appropriate consent category for Webeyez. Most organizations place it under Performance Cookies or Analytics Cookies.
- Navigate to your cookie script settings and add the Webeyez JavaScript tracking snippet as a Custom Script.
- Explicitly assign this script to your chosen Analytics/Performance category.
- 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:
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:
- Ensure the OneTrust CMP script is correctly deployed on your website.
- In GTM, build or open your existing Webeyez Custom HTML or standard script tag.
- Instead of setting the tag trigger to All Pages, use OneTrust's data layer events.
- Configure a custom event trigger (typically
OneTrustGroupsUpdated) that checks if theOnetrustActiveGroupsvariable 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.