Sessions & Packages
How ExpressConsent groups related CDRs for multi-step flows and co-registration.
If your form is a single page, sessions and packages are handled automatically. You can ignore this page and just store cdrId.
The model
- A CDR is one piece of evidence, identified by
cdrId. - A Session groups CDRs from the same browser tab. The SDK manages sessions automatically.
- A Package is a session-grouped bundle of CDRs, visible in the dashboard. Every CDR belongs to at least one Package.
Multi-step flows
Call captureCDR() at each consent moment in the same tab. The SDK reuses the session and groups them into one Package.
// Step 1 (consent page)
const r1 = await window.ExpressConsent.captureCDR();
// Step 2 (confirmation page, same tab)
const r2 = await window.ExpressConsent.captureCDR();
// Both CDRs share the same session and appear in one Package.Sub-group packages (co-registration)
Use subGroupIds to create additional Packages within the same session. This is useful for co-registration flows where you share evidence with different lead buyers. Each sub-group Package contains only the CDRs tagged with that ID, so you can exclude certain pages from a Package when you don’t want a specific buyer to see them (for example, pages containing PII that buyer shouldn’t access).
// Create sub-group Packages for different lead buyers.
// Each buyer's Package will only contain the CDRs tagged with their ID.
await window.ExpressConsent.captureCDR({
subGroupIds: ["buyer-a", "buyer-b"],
});subGroupIds accepts up to 5 unique non-empty strings.
To actually send the evidence to buyers, pair sub-groups with auto-share — pass autoShare: true alongside subGroupIds and the share URL is generated automatically.
What to store
- Always store
cdrId. - Store
shareUrlif you use autoShare — send it with your lead to the buyer. - Only store
packageDataif you’re building package-aware workflows (buyer bundles, etc). It containspackageIdandsubGroupIdMap.
Common pitfalls
- Capturing from different tabs creates separate sessions (and separate Packages)
- Long idle gaps between steps can roll the session over, splitting the flow into multiple Packages