Cloudflare Rocket Loader compatibility with CookieHub
Cloudflare’s Rocket Loader improves load times by optimizing JavaScript delivery, but its asynchronous loading can interfere with CookieHub scripts. This may cause timing issues or delays in initializing the cookie consent dialog.
To prevent this, you need to exclude the CookieHub script from Rocket Loader optimization by adding the data-cfasync="false" attribute.
Why this is needed
Rocket Loader loads JavaScript asynchronously to speed up page performance. CookieHub scripts require a specific loading order to work correctly. Adding data-cfasync="false" ensures the script loads as intended.
How to exclude CookieHub from Rocket Loader
- Locate the CookieHub script tag in your site’s HTML. It usually appears in the
<head>or<body>and includescdn.cookiehub.euorcookiehub.netin the URL. - Add the
data-cfasync="false"attribute to the script tag.
Example before:
<script src="https://cdn.cookiehub.eu/c2/xxxxxxxx.js"></script>
Example after:
<script data-cfasync="false" src="https://cdn.cookiehub.eu/c2/xxxxxxxx.js"></script>
This change tells Rocket Loader to load the CookieHub script in the correct order, avoiding conflicts.