datadog-ux-utils Documentation - v1.0.0
    Preparing search index...

    Function startLayoutShiftTracking

    • Starts tracking Cumulative Layout Shift (CLS) for the current page.

      Parameters

      Returns () => void

      A function to stop tracking CLS.

      import { startLayoutShiftTracking } from "datadog-ux-utils/layoutShifts";

      const stopTracking = startLayoutShiftTracking({
      onChange: (cls, entry) => {
      console.log("CLS updated:", cls, entry);
      }
      });

      // Stop tracking later:
      stopTracking();