An optional analytics checkbox is shown off by default with helper text and a no-script-loaded note.

Program

Optional preference controls should make the off state and helper text visible. This lesson does not load analytics.

optional_analytics_toggle.html
Visuals: captured from real browser rendering
<section class="analytics-choice">
  <h2>Optional analytics</h2>
  <label><input type="checkbox" name="analytics" value="on" aria-describedby="analytics-help analytics-note"> Share optional usage analytics</label>
  <p id="analytics-help">Off by default. You can leave it off and continue.</p>
  <p id="analytics-note" class="note">No analytics script loads in this lesson.</p>
</section>
<style>
  .analytics-choice { display: grid; gap: 10px; max-width: 32rem; border: 1px solid #94a3b8; padding: 12px; }
  .analytics-choice label { display: flex; gap: 8px; align-items: center; }
  .note { margin: 0; color: #475569; }
</style>
  1. Name the optional choice.

    The heading says this is an optional analytics choice.
    The heading says this is an optional analytics choice.
  2. Use a checkbox for the optional toggle.

    The checkbox represents an on/off preference.
    The checkbox represents an on/off preference.
  3. Show the off default state.

    The checkbox has no checked attribute, so the static state is off.
    The checkbox has no checked attribute, so the static state is off.
  4. Connect helper and note text.

    The checkbox points to the helper and no-script note.
    The checkbox points to the helper and no-script note.
  5. Explain the default.

    The helper says the user can leave analytics off.
    The helper says the user can leave analytics off.
  6. Check the optional analytics toggle.

    The toggle is off, described, and explicitly does not load analytics.
    The toggle is off, described, and explicitly does not load analytics.
optional checkbox A checkbox can represent an optional on/off choice.
off by default Leaving checked off shows the default state clearly.
no analytics script The lesson should not imply analytics code loaded.