Ensure compliance with privacy regulations by preventing Justuno from loading until a visitor has explicitly accepted your site’s cookie banner.
At a glance:
Suppress Justuno from Automatically Initializing
Introduction
This setup allows you to delay all Justuno scripts and functionality until third-party tracking consent is granted, helping maintain a privacy-first experience without compromising performance or user trust.
Suppress Justuno from Automatically Initializing
To prevent Justuno from loading immediately when the page loads, add the following line before the Justuno embed script in your theme’s <head>:
<script>window.ju4_suppress = true</script>
This tells Justuno not to initialize automatically, allowing you to control when it loads—only after cookie consent is granted.
Initialize Justuno After Vistior Accepts Cookies
Once a visitor accepts your cookie policy, you can manually trigger Justuno to load by executing the following JavaScript:
<script>window.postMessage('_jst_initialize');</script>
You should fire this line immediately after the visitor grants tracking consent. Most cookie banners or consent managers provide a callback or event handler where this line can be inserted.
Example Workflow:
-
User visits the site → Justuno is not loaded.
-
User clicks “Accept” on your cookie banner.
-
Your banner’s script runs:
window.postMessage('_jst_initialize');
-
Justuno loads and functions as normal from that point forward.
Notes:
-
Be sure your cookie banner provides a reliable way to detect when consent is granted.
-
This method does not affect Justuno’s functionality once initialized—it simply delays it until you choose to load it.