Didomi - Developers documentation
  • Introduction
  • SDKs
    • Introduction
    • Web SDK
      • Getting started
      • Tags and vendors management
        • Tags management
          • Events & Variables
            • Deprecated
            • Custom events
          • Tag managers
            • Adobe Launch/DTM
            • Eulerian
            • Google Tag Manager
              • Configure the Didomi / GTM integration
              • Didomi's GTM template
            • Tealium
            • Other tag managers
        • Custom Didomi <script> tags
        • Third-party integrations
          • Google Ad Manager / AdSense
            • GDPR via Non-Personalized Ads
              • Share consent and load/refresh ads
              • Share consent without loading or refreshing ads
            • US states laws
          • Google Consent Mode V2
          • Kameleoon
          • Piano Analytics (AT Internet)
          • Prebid
            • GDPR via IAB TCF
            • US states laws
          • Salesforce DMP (Krux)
        • IAB frameworks
        • Programmatic API
      • Configuration
        • Bots (SEO & Performance tools)
        • Configuration by URL
        • Cookies and storage
        • Custom domains for events
        • Notice
          • Behavior
          • Interactions
          • Look and feel
        • Preferences
        • Theme
      • AB tests
      • Custom domain
        • Domain delegation
        • Reverse proxy
      • Share consents between domains
      • Share consents across devices
      • Pass user choices in query string
      • Serve Didomi assets from your domain
      • Reference
        • API
          • Deprecated
        • Events
      • Performance
      • Versions
    • Mobile and TV SDKs
      • Android and Android TV
        • Setup
        • Logging
        • Reference
          • API
            • Deprecated
          • Events
        • Versions
      • iOS and tvOS
        • Setup
        • Logging
        • App Tracking Transparency (iOS 14.5+)
        • Reference
          • API
            • Deprecated
          • Events
        • Versions
      • Unity
        • Setup
        • Reference
        • Versions
        • Troubleshooting
      • React Native
        • Setup
        • Reference
          • Deprecated
        • Versions
      • Flutter
        • Setup
        • Reference
        • Versions
      • Consent notice
        • Getting started
        • Customize the notice
        • Customize the preferences popup
        • Customize the theme & UI
        • Load notice by ID
      • Third-party SDKs
      • Share consents across devices
      • Share consent with WebViews
      • Google Consent Mode v2
      • FAQ
    • AMP SDK
      • Blocking Behaviors
        • Load immediately on page load
        • Load only after consent (positive or negative)
        • Load only after positive consent
      • Consent status for vendors
    • Help & Support
  • API
    • Introduction
      • Authentication
      • Errors
      • Pagination
      • Filters
      • Caching
      • Rate limiting
      • Quotas
      • Translations
    • Data Manager
      • Regulations
      • Configuration Tree
      • Purposes
        • Purposes & Vendors Numerical IDs
      • Preferences Library
      • User Rights
    • Widgets
      • Consent notices
        • Notices
        • Configurations
        • Multi-Regulation Configurations
          • Migration of Existing Notices and API Updates
        • Deployments
        • Tutorials
          • Create and publish a consent notice
          • Create and publish a multi-regulation consent notice
      • Privacy widgets
        • Create a widget
        • Retrieve widgets
        • Edit a widget
          • Content & Design
            • Themes & Shapes
            • Components
              • auth
              • dsar_form
              • footer
              • header
              • preference
              • preference_value
              • save
              • section
              • sections
            • Options
          • Purposes & preferences
          • Settings
        • Deploy a Widget
          • Use your own subdomain
          • Use your own domain
          • Implement an embeddable widget on your website
        • Authentication
          • Manage authentication providers
          • Authenticate your end-user
        • Archive a widget
        • Headless widgets
          • Public Methods
          • Custom elements
          • Custom events
          • Event listeners
        • Tutorial
          • Launch a Preference Center from a mobile app
    • Compliance Reports
      • Properties
      • Reports
      • CSV format reference
      • Websites
    • Consents and Preferences
      • Events
        • Generate IAB TCF consent string
      • Links
      • Proofs
      • Tokens
      • Secrets
      • Users
      • Tutorial
        • Collect and operate data
    • Privacy Requests
      • Requests
      • Notes
      • Links
      • Emails
  • Integrations
    • Introduction
      • Quotas
    • Generic integrations
      • Batch export
        • Destinations
          • AWS S3 Bucket (owned by Didomi)
          • GCP Storage Bucket
        • Exported data
          • Notices consents
        • Logs
      • Webhooks
      • Batch import
      • Analytics export
        • Destinations
          • AWS S3 Bucket (owned by Didomi)
          • GCP Storage Bucket
    • Third-party apps
      • CMP integrations
        • Didomi-mParticle integration for your CMP
        • Deploy Didomi’s SDK for your Adobe Commerce website
      • Preference Management Platform integrations
        • Actito
        • Adobe Campaign Classic
        • Adobe Experience Cloud
        • Adobe Marketo Engage
        • Adobe Source Connector
        • Braze
        • Dotdigital
        • Hubspot
        • Mailchimp
        • Microsoft Dynamics 365
        • Salesforce Marketing Cloud
        • Salesforce Sales & Service Cloud
        • Selligent
        • Brevo (ex Sendinblue)
    • Tutorials
      • Configure a HTTP webhook
      • Configure a batch export
      • Configure an analytics export
    • Emailing
      • Configurations
        • Actito Email
        • Actito SMS
        • Adobe Campaign Classic
        • Adobe Campaign Standard
      • Emails
        • Templates
        • Manage your templates
Powered by GitBook
On this page
  • Load time
  • Core Web Vitals
  1. SDKs
  2. Web SDK

Performance

At Didomi, we understand the critical importance of maintaining optimal web performance while ensuring compliance with data privacy regulations through our Consent Management Platform (CMP).

CMPs, while essential, can introduce additional JavaScript and network requests that may impact Core Web Vitals—key metrics for assessing web performance and user experience. Specifically, these additional elements can affect Largest Contentful Paint (LCP), Interaction to Next Paint (INP), and Cumulative Layout Shift (CLS).

To address these concerns, the Didomi Web SDK is engineered to be lightweight and highly efficient, minimizing its impact on these vital metrics. This section of the documentation provides insights and best practices for integrating the Didomi CMP without compromising on performance, ensuring both compliance and an excellent user experience.

Load time

The Didomi Web 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 elements 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 loader script (the one included from the Console) to append our SDK in the head of the page. If your DOM is loaded after 5 seconds, our SDK will start to load after 5 seconds. Even if you add the loader at 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 defer or async , for example.

  • Make sure the Didomi script is placed first, at the head of the page. Adding our loader in an external Javascript file or in the footer will delay its execution.

  • Reduce the number of calls or scripts loaded by your page and/or move them to the body section of the page.

Core Web Vitals

Largest Contentful Paint (LCP)

LCP measures the loading performance of the largest visible element in the viewport. A slow LCP can result from heavy JavaScript, large images, or slow server response times.

Recommendations:

  • Ensure that the CMP script is loaded asynchronously.

  • Lazy load non-essential elements.

  • Optimize images and other large assets for faster loading.

  • Use efficient caching strategies to speed up server response times.

Interaction to Next Paint (INP)

INP evaluates the responsiveness of the page to user interactions by measuring the delay between user input and the next frame rendered.

Recommendations:

  • Efficient Code in Callbacks:

      • TCF API callbacks

      • Didomi events callbacks (e.g., consent.changed, notice.hidden)

      • Integrations and Tag Managers (e.g., dataLayer.push)

  • Vendor and Purpose Limitation:

    • Limit the number of vendors and purposes in the consent notice to only those necessary. Avoid including all IAB vendors if not required.

  • Deferred Loading of Third-Party Scripts:

    • Avoid loading third-party scripts immediately, as they can burden the main thread and impact performance.

  • Custom UI Implementations:

Cumulative Layout Shift (CLS)

CLS quantifies the visual stability of a page by measuring unexpected layout shifts. High CLS can occur if the Didomi CMP dynamically inserts elements without reserving space in advance.

Recommendations:

  • Pre-allocate space for the CMP elements.

  • Use CSS to minimize layout shifts during loading.

  • Avoid inserting elements above existing content.

  • Implement placeholder elements to maintain layout stability.

Total Blocking Time (TBT)

TBT measures the total time that a page is blocked from responding to user input due to long-running tasks.

Recommendations:

  • Break up long tasks into smaller chunks.

  • Defer non-critical JavaScript.

  • Leverage web workers where possible.

  • Optimize the CMP script for minimal blocking and quick execution.

By implementing these strategies, you can significantly improve the load time and performance impact of the Didomi SDK and ensure a better user experience on your website.

PreviousEventsNextVersions

Last updated 10 months ago

Ensure that the code within these callbacks is performant and yields at appropriate points (more information about yielding on ) to prevent lengthy tasks:

If using custom UI elements, adhere to for buttons, links, or any interactive components to ensure smooth user interactions.

https://web.dev/articles/optimize-inp#yield_to_the_main_thread_often
INP best practices