The Didomi SDK needs to be loaded and ready before the notice is displayed or third-party scripts like ads are loaded. Depending on how your website is built, this might add a delay.
There are 2 main reasons that can slow down the SDK loading process:
- 1.Your website is loading a lot of resources and scripts. Didomi needs the DOM to be loaded for the
loaderscript (the one included from the Console) to append our SDK in the
headof the page. If your DOM is loaded after 5 seconds, our SDK will start to load after 5 seconds. Even if you add the
loaderat the top of the
head, the progression will be stuck until the DOM is loaded. It is important for you to make sure the DOM is ready as fast as possible and that no scripts are blocking the thread and slowing down the loading process. If your website loads a lot of resources like scripts and CSS, the SDK will be placed at the end of the queue and wait until the others are loaded.
- 2.You are using shared consent via a custom domain. When using shared consent, the Didomi SDK uses an iframe on your designated domain to read and write cookies from that domain. This involves asynchronous operations for loading the iframe and communicating with it that will slow down the execution of the SDK. If load time is key, we recommend not sharing consent across domains.
To optimize the load time of the SDK, you can explore the following options:
- Make sure the DOM is loaded as fast as possible and no other scripts are blocking the DOM from being ready. You can read more about the use of
async, for example.
- Make sure the Didomi script is placed first, at the
headof the page. Adding our
- Reduce the number of calls or scripts loaded by your page and/or move them to the
bodysection of the page.