Tagging a form
Tagging a form enables features such as extracting disclosure language into the CDR, recording whether consent was provided, and highlighting the submit button. These features strengthen the CDR, and affiliates often require them. Tagging is simple, but it is important to implement it correctly.
Tag the disclosure, checkbox, and submit control:
<p data-ec-disclosure="tcpa">
By submitting this form, you agree to be contacted at the number provided,
including by automated technology.
</p>
<input type="checkbox" data-ec-consent-checkbox data-ec-consent-for="tcpa" />
<button type="submit" data-ec-submit>Get my quote</button>Name your disclosures
Provide an optional name for data-ec-disclosure by adding data-ec-disclosure="NAME_HERE". This is helpful when you have multiple disclosures and checkboxes and need to match them to each other.
Bind each checkbox to what it governs
data-ec-consent-for names the disclosure or disclosures a checkbox stands for. It takes a space-separated list, so one checkbox can cover several:
<input
type="checkbox"
data-ec-consent-checkbox
data-ec-consent-for="tcpa marketing"
/>You can leave the binding off in exactly one situation: a page with one disclosure and one checkbox, where the checkbox declares no binding, is bound for you. On any other shape an unbound checkbox binds to nothing, which is worse than having no checkbox at all. See the warning further down.
The checkbox itself does not have to be an <input>. A role="checkbox" or role="switch" widget works, read through aria-checked, and so does a container that wraps exactly one of those, which covers most styled checkboxes. A container wrapping none, or more than one, cannot be read, and we never guess between two controls.
When several readable checkboxes bind to one disclosure, consent is reported as affirmative only if every one of them was checked.
Tag the submit buttons
This tells ExpressConsent which HTML element to monitor and lets us highlight the submit control in the visual record. This is especially important on pages with multiple submit buttons, because without the highlight there is no way to tell which control caused the submission. It is important on pages with one submit control as well.
One broken checkbox degrades the whole page
A consent checkbox that binds to nothing (a typo in data-ec-consent-for, an
empty value, or an unbound checkbox on a page that is not one-and-one) makes
the page ambiguous. Every disclosure that has no checkbox of its own then drops
from consent-by-submission to no consent detected, because a page that has a
consent control somewhere cannot be read as though it had none. One typo can
empty the consent facts on a page full of correctly tagged disclosures.
The same happens for a bound checkbox that cannot be read: a disclosure whose checkbox we failed to resolve is never reported as consent by submission.
An unreadable checkbox counts toward the page's checkbox total too, so a stray data-ec-consent-checkbox left on a decorative wrapper both disables the automatic one-and-one binding and orphans itself.