---
title: "How to Track AJAX Forms"
description: "Track form submissions and conversions from AJAX forms with Sealmetrics. Works with any JavaScript framework."
canonical_url: "https://docs.sealmetrics.com/implementation/tracking-methods/how-to-track-ajax-forms"
lang: "en"
date_generated: "2026-08-27T14:18:06.639Z"
source_hash: "3a6d1161f23534825ef039e24b9a1ead9b5d46398d25c060fd1d4996d0ca5aa5"
content_type: "implementation"
owner: "engineering"
llm_priority: "critical"
source_file: "implementation/tracking-methods/how-to-track-ajax-forms.mdx"
publisher: "Sealmetrics"
---

# How to Track AJAX Forms

Canonical page: https://docs.sealmetrics.com/implementation/tracking-methods/how-to-track-ajax-forms

Track conversions when AJAX forms are submitted successfully.

---

## Prerequisites

Ensure the Sealmetrics tracker is installed on your page:

```html
<script src="https://t.sealmetrics.com/t.js?id=YOUR_ACCOUNT_ID" defer></script>
```

---

## Basic Implementation

Call `sealmetrics.conv()` or `sealmetrics.micro()` in your AJAX success callback:

```javascript
// Example with fetch API
fetch('/api/submit-form', {
  method: 'POST',
  body: formData
})
.then(response => response.json())
.then(data => {
  if (data.success) {
    // Track the form submission as a conversion
    if (typeof sealmetrics !== 'undefined') {
      sealmetrics.conv('lead', 0, {
        form_name: 'contact',
        form_location: 'homepage'
      });
    }
  }
});
```

---

## jQuery AJAX Example

```javascript
$.ajax({
  url: '/api/submit-form',
  method: 'POST',
  data: formData,
  success: function(response) {
    // Track successful submission
    if (typeof sealmetrics !== 'undefined') {
      sealmetrics.conv('lead', 0, {
        form_name: 'newsletter',
        source: 'footer'
      });
    }
  }
});
```

---

## Conversion vs Microconversion

Choose the right method based on your goal:

| Goal Type | Method | Example |
|-----------|--------|---------|
| Lead form (valuable) | `sealmetrics.conv()` | Contact form, quote request |
| Newsletter signup | `sealmetrics.conv()` | Email subscription |
| Minor interaction | `sealmetrics.micro()` | Feedback form, comments |

### Conversion Example (with value)

```javascript
// Lead with estimated value
sealmetrics.conv('lead', 50, {
  form_name: 'quote_request',
  service: 'consulting'
});
```

### Microconversion Example

```javascript
// Form step completion (no monetary value)
sealmetrics.micro('form_step', {
  step: 'personal_info',
  form_name: 'checkout'
});
```

---

## Framework Examples

### React

```jsx
const handleSubmit = async (e) => {
  e.preventDefault();

  try {
    const response = await fetch('/api/contact', {
      method: 'POST',
      body: JSON.stringify(formData)
    });

    if (response.ok) {
      // Track conversion
      if (typeof sealmetrics !== 'undefined') {
        sealmetrics.conv('lead', 0, {
          form_name: 'contact'
        });
      }
    }
  } catch (error) {
    console.error('Form submission failed');
  }
};
```

### Vue.js

```javascript
async submitForm() {
  try {
    await this.$axios.post('/api/contact', this.formData);

    // Track conversion
    if (typeof sealmetrics !== 'undefined') {
      sealmetrics.conv('lead', 0, {
        form_name: 'contact'
      });
    }
  } catch (error) {
    console.error('Form submission failed');
  }
}
```

---

## Best Practices

1. **Track only on success** — Don't fire tracking on form errors
2. **Check tracker exists** — Always use `typeof sealmetrics !== 'undefined'`
3. **Include form context** — Add properties like `form_name` and `form_location`
4. **Avoid duplicates** — Track once per successful submission

---

## Troubleshooting

### Conversion not appearing

1. Check browser Network tab for beacon to `t.sealmetrics.com`
2. Verify the tracker script is loaded before your AJAX code
3. Ensure the success callback is actually firing

### Duplicate conversions

If you're seeing duplicates, ensure your tracking code only fires once:

```javascript
let formTracked = false;

function onFormSuccess() {
  if (!formTracked && typeof sealmetrics !== 'undefined') {
    sealmetrics.conv('lead', 0, { form_name: 'contact' });
    formTracked = true;
  }
}
```

---

## Related Documentation

- [Conversions](/implementation/tracker/conversions) - Full conversion tracking reference
- [Microconversions](/implementation/tracker/microconversions) - Event tracking
- [Troubleshooting](/troubleshooting) - Common issues and solutions
