Usercentrics - PUBLIC

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Loader.js is the newest version of our CMPv2 Script, with improved performance, by adding code splitting and automatically deciding what version of bundle.js should you use, based on your browser version.

Loader.js Scripts

The loader.js is a new script, so you will need to change your bundle.js or bundle_legacy.js scripts by these new ones:

  • If you are using TCF2.0

    <script id="usercentrics-cmp" data-settings-id="XXXXXXX" src="https://app.usercentrics.eu/browser-ui/latest/loader.js" data-tcf-enabled></script>
  • If you aren’t using TCF2.0

    <script id="usercentrics-cmp" src="https://app.usercentrics.eu/browser-ui/latest/loader.js" data-settings-id="XXXXXXX" async></script>

Do not worry about legacy browsers. loader.js will automatically decide if it should use bundle.js or bundle_legacy.js based in your browser and in your browser version.

Why should you update to this new script

With all the variants inside the same base code, we’re shipping more code and data than necessary for the CMP, that’s why we created this script with code splitting in mind. Code Splitting will split the code to ship only the necessary code based on the variant (TCF, CCPA, Default UI, Legacy Browser, …)

Having this change to the code increases the performance of our CMP and therefore increases the lighthouse performance of your page.

Code that also needs to be adapted

As you've seen in your consoles inside your pages, there are some functions from our API that are deprecated, so you will need to adapt them to the new versions:

About the current scripts

No, we won't stop supporting the current scripts, bundle.js, and bundle_legacy.js. We will keep supporting them, but to take advantage of the performance improvements now and in the future we strongly suggest this change.

  • No labels