The Secure Enclave is an essential feature of DataUnlocker that allows you to securely embed tracking or analytics code (e.g., Google Tag Manager, Meta Pixel, Hotjar, etc.) into your web applications without exposing it to client-side blockers or interfering scripts.
DataUnlocker's Secure Enclave is the default and recommended method to embed tracking code on your websites to improve data collection accuracy.
To access and edit the code in the Secure Enclave for your domain:
Click on + Add custom code
or Edit
to open the editor. You can paste any HTML-like content here. For example, to install Google Tag Manager, add the suggested code block:
<script src="https://www.googletagmanager.com/gtag/js?id=G-XXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-XXXXX');
</script>
This code will be automatically injected into your site by DataUnlocker Defender when it loads.
Once saved, DataUnlocker Defender will:
You can return at any time to:
All changes are applied live without requiring a new deployment.
onLoad
handler from the @dataunlocker/defender NPM package) is supported, but only recommended if you're confident in what you're doing.Tracking and analytics scripts are often blocked by privacy tools and browser extensions. By using DataUnlocker’s Secure Enclave:
Yes. Scripts are sandboxed and delivered via DataUnlocker Defender. They won’t run unless DataUnlocker is properly installed and active.
Yes. You can include any valid HTML, including inline styles, scripts, and iframes. For best results, only include what's necessary for your tracking setup.
Yes. Scripts can load dynamic content as long as they are valid client-side JavaScript.
The script will stop being injected into your site immediately. You can re-add it at any time.
Yes, and positively. The tracking code is injected asynchronously after DataUnlocker fully loads—typically around 100 milliseconds after the embedded DataUnlocker code runs. This keeps your main rendering path clear and improves page load speed for end users.
For any questions or assistance, click the "Need help?" link on the Secure Enclave page.