DataUnlocker's secure enclave

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.

✨ Key Benefits

  • Protection from Blockers: Code added to the Secure Enclave is injected and obfuscated by DataUnlocker Defender, helping it evade popular ad blockers and script disablers. DataUnlocker maintains and ensures this code remains functional.
  • Centralized Configuration: Easily manage and update your tracking scripts directly from the DataUnlocker dashboard.
  • No Need to Modify Site Code: Add, edit, or remove tracking snippets without changing your frontend code.
  • Safe for Production: Code is injected only when DataUnlocker is active, ensuring that your site behaves as expected. This feature is essential to how DataUnlocker works and should be used when tracking is required.

📁 Where to Find It

To access and edit the code in the Secure Enclave for your domain:

  1. Open your DataUnlocker Dashboard.
  2. Select your project and domain from the sidebar.
  3. Navigate to Settings > Secure Enclave.

✍️ How It Works

1. Add Code

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.

2. Defender Injection & Obfuscation

Once saved, DataUnlocker Defender will:

  • Obfuscate the code to reduce detectability.
  • Inject it dynamically into the page during runtime.
  • Ensure it bypasses common blocking mechanisms.

3. Management

You can return at any time to:

  • Edit the code
  • Preview the injected result
  • Remove it entirely

All changes are applied live without requiring a new deployment.

🛡️ Best Practices

  • Use the Secure Enclave instead of embedding tracking code directly into your frontend files.
  • Place all major analytics tools (Google Tag Manager (GTM), Meta Pixel, Hotjar, etc.) in the Secure Enclave.
  • Avoid duplication: do not embed the same script in both the Enclave and your site.
  • For advanced users, direct client-side code injection (e.g., using an onLoad handler from the @dataunlocker/defender NPM package) is supported, but only recommended if you're confident in what you're doing.

🤔 Why It Matters

Tracking and analytics scripts are often blocked by privacy tools and browser extensions. By using DataUnlocker’s Secure Enclave:

  • You preserve analytics accuracy.
  • Improve conversion tracking reliability.
  • Avoid data loss in marketing funnels.

❓ FAQ

Is it safe to put third-party scripts in the Secure Enclave?

Yes. Scripts are sandboxed and delivered via DataUnlocker Defender. They won’t run unless DataUnlocker is properly installed and active.

Can I put custom HTML or inline styles?

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.

Does the Secure Enclave support dynamic content?

Yes. Scripts can load dynamic content as long as they are valid client-side JavaScript.

What happens if I remove a script?

The script will stop being injected into your site immediately. You can re-add it at any time.

Does DataUnlocker's Secure Enclave affect my website's performance?

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.