Quickstart

Load the SDK, capture consent evidence on form submit, and verify it appears in the dashboard.

1. Add the SDK to your page

Add this script tag in your <head>. Replace YOUR_CID with the CID from your organization settings page in the dashboard.

html
<script
  src="https://sdk.expressconsent.com/sdk/v1/sdk.js"
  data-ec-cid="YOUR_CID"
></script>

2. Capture evidence on submit

Call captureCDR() inside your form submit handler, before page navigation. The returned cdrId is your evidence ID — store it with your lead/user record.

javascript
document.getElementById("consentForm")?.addEventListener("submit", async (e) => {
  e.preventDefault();

  // Generate or retrieve a unique ID for this submission BEFORE calling captureCDR.
  // This lets you find the CDR later even if the initial upload fails.
  const leadId = crypto.randomUUID();

  try {
    const { cdrId } = await window.ExpressConsent.captureCDR({
      custom: {
        uid: leadId,
        phoneNumber: document.getElementById("phone")?.value ?? "",
      },
    });

    // ✅ Save cdrId with your lead/user record.
    console.log("Evidence saved:", cdrId);
  } catch (err) {
    console.error("ExpressConsent capture failed:", err);
    // The SDK saved the CDR locally and will retry on the next page load.
    // Save your lead record without a cdrId — you can reconcile later
    // using the uid you passed in custom metadata.
  }

  e.currentTarget.submit();
});

3. Verify in the dashboard

Run a test submission, then confirm the CDR appears:

  1. Sign in → select your organization → open your domain → go to CDRs
  2. Find your cdrId in the list
  3. Open it and confirm the visual record (screenshot) clearly shows consent UI + legal text

4. Quick fidelity check

Open the CDR and confirm the visual record shows:

  • The consent checkbox/control visibly selected
  • The full consent/TCPA disclaimer text (not truncated or hidden)
  • No ambiguity from responsive layouts collapsing legal text

Review the Troubleshooting page for a full checklist of page patterns that can affect snapshot fidelity (cross-origin iframes, lazy-loaded assets, animations on consent elements, etc.).

Done

Your integration is working. Store cdrId with every lead/user record going forward.