Most A/B tests on law firm sites are scored in the analytics tool: version A got this many form submissions, version B got that many. The trouble starts a few weeks later, when the intake team wants to know which version actually produced signed cases. Analytics can't tell them, because the form submission never carried the variant into the firm's intake system.
The fix is small. Record the variant the visitor saw inside the form submission itself, so it travels with the lead into email, the CRM or the case management tool. This post walks through a simple approach for a static or lightly scripted law firm site, plus a few things to get right along the way.
Why analytics alone isn't enough
Analytics tools count events. They're good at telling you that variant B produced more form submissions. They aren't good at telling you which of those submissions turned into a consultation, and which consultations turned into a paying client.
For a criminal defense firm, that difference matters. A form change might produce more submissions but attract more spam, wrong-practice inquiries or people outside the firm's area. If the variant lives in the lead record, the intake team can mark outcomes and you can compare signed cases per variant months later.
Assign the variant once and keep it
The variant must stay stable for a visitor across page loads, or the data becomes meaningless. A first-party cookie works for most sites. If you already run tests with a server-side split, such as an edge function that sets a cookie, read that cookie. If not, assign it in the browser before the form renders.
Whatever you use, make sure the same visitor sees the same version on every page in the test, and that assignment happens before any analytics event fires.
Add the variant to the form
Add a hidden input to the form and fill it from the cookie. Here's a minimal version without dependencies:
const name = "lp_variant"; let v = document.cookie.match(new RegExp(name + "=([^;]+)"))?.[1]; if (!v) { v = Math.random() < 0.5 ? "a" : "b"; document.cookie = `${name}=${v}; path=/; max-age=2592000; SameSite=Lax`; } document.querySelectorAll("form[data-intake]").forEach(f => { const i = document.createElement("input"); i.type = "hidden"; i.name = "test_variant"; i.value = `charge-intro-2026-11:${v}`; f.appendChild(i); }); Prefix the value with a test name and date. Six months from now, "b" on its own will mean nothing to anyone.
Pass it through to intake
Check every step the submission passes through. Form handlers, email templates, Zapier-style connectors and CRM field mappings often drop fields they don't recognize. Create a matching field in the intake system and confirm it fills on a test submission.
Run a test submission for each variant and open the record in the intake system yourself. Seeing the field filled in on a real record is the only proof that the chain works.
Phone calls are the harder half. Most defense leads call rather than fill a form. If you use call tracking with dynamic number insertion, ask whether it can show a different number per variant or attach a custom value to each call record. If it can't, at least record the landing page with each call so you can match it to the test dates.
Keep it clean and private
A few rules keep this safe on a law firm site:
- Don't put anything about the visitor's case into the variant value or the cookie
- Don't send form contents to analytics tools, only the event and the variant
- Exclude test and staff submissions by IP or a staff cookie
- Remove the hidden field when the test ends, so old variant values don't confuse future reports
Some state bar rules touch on how firms handle prospective client information, so keep the firm's lawyers involved in decisions about where lead data is stored.
Read results at the right level
When the test ends, report three numbers per variant: submissions, consultations booked and cases signed. On a low-traffic site, the signed-case numbers will be small, and you shouldn't treat a gap of one or two as a result. The value is in spotting a variant that produces more submissions but fewer real cases.
For guidance on judging small numbers, see this write-up on running a conversion test on a low-traffic defense website. For more on testing methods for law firm sites, there's also a set of conversion testing guides for law firm websites.
Questions developers ask about tagging leads by variant
Will a hidden field hurt SEO?
No. A hidden form input doesn't affect how search engines read the page. Just avoid serving different content to crawlers and users in ways that could look like cloaking.
Should the cookie need consent?
That depends on the firm's location and the privacy laws it follows. A first-party cookie used only for the test is usually low risk, but check with the firm before launch.
What if the firm uses a hosted form?
Many hosted form tools support hidden fields filled from URL parameters or scripts. Check the tool's documentation for how it accepts prefilled hidden values.
SBD Marketing works only with criminal defense law firms, one per city. It builds defense firm websites, runs SEO for the charges a firm defends, works on getting firms named in AI search tools and runs SEO audits.