← Form tracking demos Watch it fail

5 · JavaScript / AJAX form

This form calls preventDefault(), posts in the background and swaps in a success message. The page never changes. This is the single most common reason a lead form produces no conversions.

Two separate problems, often confused. The hidden field on this page is substituted correctly — it is plain HTML present at load, so the inspector shows a real Click ID. What breaks is the event: there is no navigation and no completed browser submit, so nothing marks the conversion. Fixing the field does not fix the event, and vice versa.
The fix. Fire the event yourself in the success handler, once you know the submission actually succeeded:
fetch('/api/lead', { method: 'POST', body: data })
  .then(function (r) { return r.json(); })
  .then(function () {

    // Wrap in the callback so the Tag is guaranteed to be ready.
    AnyTrack(function () {
      AnyTrack('trigger', 'Lead', {
        email: emailField.value,   // raw — AnyTrack hashes it per platform
        unique: 'client'           // one Lead per visitor, even on a retry
      });
    });

    showSuccess();
  });
Use value, not revenue or amount. If the lead is worth something, value: 29.90 as a number — and then the event should be CompleteRegistration rather than Lead, since Lead is the zero-value one. A key AnyTrack does not recognise is ignored silently, not rejected.
Do not fire it on click. Attaching the event to the button counts submissions that failed validation or never reached the server. Fire it where the success actually lands.