Osano and Rocket Loader

  • Updated

When you place the Osano.js on your website to manage your user's consent, the javascript in question functions by monitoring and manipulating the Document Object Model [DOM], this is why the Osano.js must execute first on the page with no defer or async attributes in place. 

Because of this functionality, specific tools, extensions, or add-ons that operate similarly (manipulating or re-writing the DOM) may conflict with Osano's standard operation.

Cloudflare's Rocket Loader

Cloudflare's Rocket Loader is a tool utilized by Cloudflare sites to manipulate your website's content. It does this by loading your page content (text, images, fonts, etc.) asynchronously to optimize page loading times. If Rocket Loader initiates Osano, the code is dynamically loaded onto your website. This behavior interrupts Osano functionality which can cause rending issues and/or other conflicts.

For functionality reasons, Osano must execute outside of Rocket Loader's manipulation. 

If Osano is dynamically loaded on your site, adding the Rocket Loader exclusion attribute to ignore individual Javascript will not work. In this case, the only option you have is to disable the Rocket Loader feature from Cloudflare.

For Osano to function as expected and to keep you in compliance, we recommend utilizing Rocket Loader's "manual" execution which will ensure that Osano is (1) executing first and (2) able to keep compliance by blocking or allowing trackers based on end-user preference. Rocket Loader can be used for "essential" elements that do not set non-essential trackers.


Solution: Enable Manual Mode

  • In Cloudflare settings, under 'Performance Settings,' set the 'Rocket Loader' option to Manual.
    • To selectively enable Rocket Loader optimization for a script, when Rocket Loader is in manual mode, set the attribute data-cfasync="true."
    • If needed, manually mark up the elements that you wish to be loaded by Rocket Loader:
      <script data-cfasync="true" src="https://example.org/js/"> . This should ONLY be used when scripts do not set non-essential cookies or trackers.