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.
<script
src="https://sdk.expressconsent.com/sdk/v1/sdk.js"
data-ec-cid="YOUR_CID"
></script>The SDK resolves its upload endpoint from the URL it was loaded from. Self-hosting will break uploads.
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.
document.getElementById("consentForm")?.addEventListener("submit", async (e) => {
e.preventDefault();
try {
const { cdrId } = await window.ExpressConsent.captureCDR({
// Optional: metadata to make this CDR searchable later.
custom: { phoneNumber: document.getElementById("phone")?.value ?? "" },
// Optional: highlight the submit button in the visual record.
highlightTarget: "submit-primary",
});
// ✅ Save this ID with your lead/user record.
console.log("Evidence saved:", cdrId);
} catch (err) {
console.error("ExpressConsent capture failed:", err);
// Decide your policy: log and continue, retry, or block submission.
// Most teams choose to log the error and let the form submit proceed.
}
e.currentTarget.submit();
});The SDK attaches itself to window.ExpressConsent. The window. prefix is required in TypeScript and linted JavaScript.
If the page navigates or the form unmounts before the promise resolves, the CDR may not be saved. Always preventDefault() → await → submit.
3. Verify in the dashboard
Run a test submission, then confirm the CDR appears:
- Sign in → select your organization → open your domain → go to CDRs
- Find your
cdrIdin the list - 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
Run at least one mobile-sized submission. If your mobile CSS hides consent language, the CDR will reflect that.
Done
Your integration is working. Store cdrId with every lead/user record going forward.
If you pass leads to other companies, add autoShare: true to your captureCDR() call. The SDK will return a shareUrl you can send to your lead buyers so they can claim the consent evidence. See Sharing with Lead Buyers.