Skip to content

Single-page apps

The CMP boots once on the initial page load and persists across client-side navigations — you don’t re-run init() on every route change. The banner, the stored decision, and every bridge stay live for the lifetime of the app session.

  • Install the Quickstart snippet in your app shell / document <head>, exactly as for a static site.
  • Read consent anywhere in app code via LightningCMP.getConsent() and react to changes with LightningCMP.onConsentChange(fn) — see the JavaScript API.
  • Open preferences from your own UI (e.g. a settings screen) with LightningCMP.openPreferences().